Thursday, December 27, 2007

I'm so damn clever

It took some doing to work out, but I added a new feature to my random quote generator.

Clicking on the "new quote" button will refresh the random quote. It's a lot faster than having to refresh the entire page.

It actually took almost two hours to work out, to ultimately add less than 5 lines of code.

Now I just need to add more quotes.

Later,

6 people have spouted off:

Qalmlea said...

Oh, cool. I was wondering if that was possible. At some point, I may spend a similar two hours! ^/^

John said...
this was the key:

document.getElementById("qt").innerHTML=quote
12/28/07, 9:14 AM
phil said...

you should put the button above the quote 'cause as different length quotes are displayed, the button moves. So for rapid clicking, you have to keep moving the mouse to follow the button - it's annoying and really slows down the click speed.

John said...
I think the button looks better below the quote, and it's my blog, so guess what?
12/29/07, 7:53 PM
tom said...

My vote's with Phil on this one.

John said...
Still my blog.
12/29/07, 10:45 PM