<html> <head> <script language="javascript" type="text/javascript"> function Sound(surl) { alert("working");<!-- this will ensure function is called successfully--> document.getElementById("myspan").innerHTML= "<embed src=\""+surl+"\" hidden=\"true\" autostart=\"true\" loop=\"false\" />"; } </script> </head> <body> <span id="myspan"></span> <form> <img src="imag.jpg" onMouseOver="Sound('success.wav')" /> </form> </span> </body> </html>
<html> <head> <script type="text/javascript"> function sound(surl) { document.getElementById("myspan").innerHTML = "<embed src="+surl+" hidden=true autostart=true loop=false>"; } </script> </head> <body> <span id="myspan"></span> <form> <img src="image.jpg" onmouseover="sound('success.wav')" /> </form> </body> </html>
https://stackoverflow.com/questions/5748174/playing-sound-file-onmouseover-event
แบบอื่น (ยากกว่า)
http://allwebco-templates.com/support/S_audio_onmouseover.htm
เสียง
https://www.soundsnap.com/tags/mouseover