You are here: irt.org | FAQ | JavaScript | Sound | Q1664 [ previous next ]
Try this:
<html> <head> <script language="JavaScript"><!-- loaded = false; function playIt(sndAction,sndObj) { // rewrite of Macromedia's script. if (eval(sndObj) != null && loaded) { if (sndAction == 'stop') sndObj.stop()); //stop, else play else (navigator.appName == 'Netscape') ? sndObj.play(false): sndObj.run(); } } //--></script> </head> <body onLoad="loaded=true"> <embed name="sound1" src="somesound.wav" loop="false" autostart="false" mastersound="mastersound" hidden="true" width="0" height="0"></embed> <a href="http://www.linktosomeplace.com" onMouseOver="playIt('play','document.sound1')" onMouseOut="playIt('stop','document.sound1')" >hover over this link to play</a> </body> </html>