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.
The biographical Wikipedia pages get a huge boost in traffic the day the person dies. This is but natural because they would be featured in the news and web users would typically like to know more. But what is surprising is that nine out of ten pages of the online encyclopaedia that have received more than 1 million views in a day have been of celebrities on the day they died. [more...]