Take the example of a image rollover effect. The logic is quite simple. Whenever the mouse pointer passes over the image the event is captured with the onmouseover event handler that can then change the value of the src property associated with the image object to another URL. Thus, a new image (with a new URL) is loaded in place of the old one.
<A HREF="http://www.webdevelopersnotes.com" onmouseover="alert('Go back to Home Page')"> Home Page</A>
Pass your mouse pointer over the link below to see how it works.
Let’s look at another example:
<A HREF="http://www.webdevelopersnotes.com" onmouseover="window.status = ('Go back to Home Page')"> Home Page</A>
Here the onmouseover event handler modifies the status property of the window object. It directs the browser to print Go back to Home Page on the status bar.
Note that in the first example, onmouseover calls the alert method while in the second it modifies a property value.
A final example before we proceed to the next session:
<A HREF="http://www.webdevelopersnotes.com" onmouseover="document.bgColor='#EEEECC'"> Home Page</A>
This time, onmouseover changes the bgColor (background color) property of the document object and sets it to a light grey color.
Way back in 2005, Software.com domain name was purchased for $3.2 Million! [more...]