Mouseover and Mouse out

We can use OnMouseover and OnMouseout events to trigger various functions or effects. We will try to learn the uses by some demos here.

OnMouseover and OnMouseout on a table row.

We can change the background color of a table row by using mouseover events. Same way we can change to different color or restore the original color by using mouseout event. Here is an example.
<table>
<tr onmouseover="this.style.background='#f1f1f1';" onmouseout="this.style.background='#cfcfcf';">
<td > this is table cell </td><td> this is another </td></tr>
</table>

Image changing onMouseOver & Out by JavaScript

We can use onMouseOver and onMouseOut events to swap images and create an image rollover navigational links. Using this when mouse is passed over the link we can display another image.

This is done by using two images. One image is displayed first as a hyper link and with the help of onMouseOut event the other image is displayed. Here are two images



Here is the demo of on Mouse Over and on Mouse out event on a image hyper link



Here is the code of the above demo
<A HREF="../" onmouseover="document.my_image.src=''images/wrong.jpg''"
onmouseout="document.my_image.src=''images/correct.jpg''" ><img src=images/correct.jpg name=my_image border=''0''></a>
Using this technique a push button type image button can be developed. On button is first displayed and the second button with Push effect is displayed once the mouse is placed over it.
Visitors Rating
Your Rating




Google+

Post Comment This is for short comments only. Use the forum for more discussions.




HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us
©2000-2018 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer