Forum Moderators: open

Message Too Old, No Replies

Sound rollover?

         

joenebula

10:05 am on Oct 28, 2005 (gmt 0)

10+ Year Member



Hi all. i have been trying to get a sound file to play when a link is rolled over. I have got some code but it is not w3c. Any help here?

Script code

</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_controlSound(x, _sndObj, sndFile) { //v3.0
var i, method = "", sndObj = eval(_sndObj);
if (sndObj!= null) {
if (navigator.appName == 'Netscape') method = "play";
else {
if (window.MM_WMP == null) {
window.MM_WMP = false;
for(i in sndObj) if (i == "ActiveMovie") {
window.MM_WMP = true; break;
} }
if (window.MM_WMP) method = "play";
else if (sndObj.FileName) method = "run";
} }
if (method) eval(_sndObj+"."+method+"()");
else window.location = sndFile;
}
//-->
</script>

link code

<a href="#" onMouseOver="MM_controlSound('play','document.CS1130491126140','load.wav')">btebnbtes </a>
<EMBED NAME='CS1130491126140' SRC='load.wav' LOOP=false AUTOSTART=false MASTERSOUND HIDDEN=true ></EMBED>

Stex

5:01 pm on Oct 30, 2005 (gmt 0)

10+ Year Member



This is probably a stupid answer/question but just incase you went too complicated too fast is it not possible to call:
MM_controlSound(url,thissound) {
document.getElementById(thissound).src = url;
document.getElementById(thissound).autostart = true;
}