Messing Around With JS

This page is for trying out some JavaScript tricks

As I started fooling around with this, it became evident that although JavaScript is really flexible and helps enormously with web page functions; it really doesn't show anything unless it's related to a button click event. I mean really, its great that you can do a calculation; but if only the end result shows up, it isn't much different than printing 57 on the page!

So this being for fun, it ends up a lot about buttons.

If you just display the time on a page, it doesn't do much in the way of jazzing up the page
Use a button with an onclick event and it shows off more style. It also has more usability.

What Time is it kids?    (hint:click the button)

How does that work:

Everything that displays on the page is part of a "Document" that is referred to as DOM. In this case I used the document getElementById to access the innerHTML Date and assign it to variable I named timer.
   <button onclick="document.getElementById('timer').innerHTML=Date()">

You can change the behavior related to the button using a variety of attributes. The next example uses a JavaScript to change the button text when the mouse moves in and out of the button.

Put Mouse Here

The next example uses the mouse down and up attributes. Click and hold down the right mouse button on box The background color and text change. When the mouse button is released the color and text will change again.

Click Me

Follow this link to see some more button stuff

The last button invokes a Form function to go back to the last page