Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | JavaScript | Sound | Q1664 [ previous next ]

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

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?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.