Ignore the button for now...
I'm attempting to make it so that you can get a new random quote by pushing a button, a la John's... At the moment, I've succeeded in creating a button that does nothing. So click on it if you want, just don't expect anything to happen.
21 comments:
If you want, I can tell you how I did it.
Eh, I'll play around some more first. Since I'm not sure we used the same script for the random quotes, it may not work quite the same way anyway.
Do you have an array of quotes that is randomly selected?
If so then it will work.
Yeah, okay. I think I'm stuck.
LOL. I got it so that the button will take you to a separate page and display a random quote on a white background... ^/^ Progress. Sort of.
sorry I goofed.
make the following changes:
document.write(quotes[index]);
becomes (replace curly braces with angle brackets, keep the quotes)
document.write("{p id='qt'}" + quotes[index] + "{/p}");
add the following above the {/script}:
function getQuote()
{
var rand = Math.round( (quote.length-1) * Math.random() ) ;
document.getElementById("qt").innerHTML=quotes[rand];
}
the button you have defined should work as is
above the {/script} means above the //--}, too
adding the paragraph tag with id allows getElementById() to find it.
the .innerHTML=quotes[rand] replaces the text.
*sighs* Still a no go. Not sure why, but it's giving me a headache so I'm giving up for the moment and reverting. Thanks anyway.
id='qt' single quotes, because it's they're nested inside " " (when the computer sees " it assume the next on is the closing)
make sure that //--} is immediately above the {/script}
seriously change id="qt" to id='qt' and it looks like it will work.
Okay, I've tried to do that twice now. And when I go back to check, it's been changed to "qt" again.
the {!-- above the function definition shold be deleted, too.
wierd.
those double quotes are the only problem I can see. they are what's keeping it from working. I donn't know why they get changed back.
Very. And frustrating. So for now it's reverted.
I got it.
go here and copy the entire thing into your random quote widget. I know it works, because I tested it on my blog.
as I was testing the ReAquire button, I saw this quote:
"The perfect blossom is a rare thing. You could spend your life looking for one, and it would not be a wasted life. ~The Last Samurai"
Do you have the followup statement where he says:
"I was wrong, they're all perfect."
Yay! That did it! THANKS!
And, no, I don't have the follow-up in there yet. I was watching it and added at least one more recently, but didn't get to that scene. It may be put in there eventually.
Cool. You're welcome. I'm gonna delete that page from my Google Docs account.
Post a Comment