How to change image on mouseover and mouseout using javascript


The following  is the code for change image when OnMouseOver and OnMouseOut:

I have taken  Home,ContactUs and Search as anchor buttons with images, when we onmouseover or onmouseout then the image will be changed as per giver src.

<a href="Home.aspx">
<img src="Images/home_off.gif" alt="Home" border="0"
    onmouseover="this.src=’Images/home_on.gif';"
    onmouseout="this.src='Images/home_off.gif';" />
</a>

<a href="ContactUs.aspx">
<img src=" Images / ContactUs _off.gif" alt="Archive" border="0"
    onmouseover="this.src= Images / ContactUs _on.gif';"
    onmouseout="this.src= Images / ContactUs _off.gif';" />
</a>

<a href="search.aspx">
<img src=" Images /search_off.gif" alt="Search" border="0"
    onmouseover="this.src= Images /search_on.gif';"
    onmouseout="this.src= Images /search_off.gif';" />
</a>

0 comments:

Post a Comment