playing sound file onMouseOver event - Javascript DOM

Javascript examples for DOM:Mouse Event

Description

playing sound file onMouseOver event

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script language="javascript" type="text/javascript">
function Sound(surl) {//from   ww  w .j  a  v a 2s  .c  om
console.log("working");
document.getElementById("myspan").innerHTML= "<embed src='http://your file.mp3' hidden='true' autostart='true' loop='false' />";
}

      </script> 
   </head> 
   <body> 
      <span id="myspan"></span> 
      <form> 
         <img src="http://www.java2s.com/style/download.png" onMouseOver="Sound('success.wav')"> 
      </form>   
   </body>
</html>

Related Tutorials