Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1664 How do you get sound to work on mouse over in both Internet Explorer and Netscape Navigator?

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>

Feedback on 'Q1664 How do you get sound to work on mouse over in both Internet Explorer and Netscape Navigator?'

©2018 Martin Webb