Change Image on mouseover and mouseout using javascript
22
June
2013

Java Script Code

imgover () {
    document.getElementByID("imgID").src = "img/newimage.jpg";
    //Code to play sound
}
imgout () {
    document.getElementByID("imgID").src = "img/image.jpg";
    //Code to stop sound
}

Html Code


<img id="imgID" src="img/image.jpg" onmouseover="imgover();" onmouseout="imgout();" />

  • 1323 View
  • Pin It