onMouseOver/onMouseOut

 

The onMouseOver event handler does something when a viewers mouse goes over a link or an image map.

The first thing I will teach you is how to make the status bar say something when a viewer puts their mouse over the page. To do this you just add 1 simple line of coding. I will place the code and then explain it.
A normal link's code looks like this:

<A href="url_to_link_to">Text for the viewer to see<a>

To make the status bar say something do this:

<A href="url_to_link_to" onMouseOver="window.status=' Text to be put in the status bar '; return true">Text to be shown on the screen<a>

Here is the explanation:
onMouseOver=
This calls the event handler onMouseOver
"window.status=' text to be put in the status bar ';
This tells the status bar to put text in
return true"
This tells the interpreter that the statement is true not false. You can make false links with return false.
Put your mouse over me!!!

Now you are probably thinking, "The text doesn't dissapear from the status bar!!!"
To get rid of the text, you do the same thing, except you use the onMouseOut event handler.
So you add: onMouseOut="window.status=' ';return true"
Here is what the link would look like if we add that.
Put your mouse over me!!!


Now that you understand that, go to Background changing buttons
Homepage Event Handlers Next