Change Image on mouseover using Java Script in ASP.Net

Change Image on mouseover using Java Script in ASP.Net

Below is the code using java script to change an image on mouseover.

Step to Add:

1)Add these code below <Title> Tag

<style type="text/css">
p {

img {
<script language="javascript" type="text/javascript">
function mouseOverImage()
document.getElementById("img2").src = "images/flower3.jpg";


function mouseOutImage()
document.getElementById("img2").src = "";



2)Then Add below code within <Form> Tag

<img id="img1" src="images/flower1.jpg" alt="image rollover" onmouseover="mouseOverImage()"
onmouseout="mouseOutImage()" />
<img id="img2" src="" alt="image rollover" />


Author: ABitSmart30 Nov 2009 Member Level: Gold   Points : 0

Please format your resource.

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: