Feedback on: irt.org FAQ Knowledge Base Q1223
Worth:
Very worth reading
Comments:
after much experimentation, I finally got this to work in IE5.5 with the following additions/changes to the code:
you need this from Q485:
var can_play = true; var mimetype = 'audio/midi';
and instead of this line in PlaySound:
document.embeds[soundName].run();
you need:
document.embeds["sound"+idx].play();
which means you don't need the if test for Navigator.
I also had to hardcode the preload of my midi files, because the first 'if' did nothing.
Worth:
Very worth reading
Comments:
The <script> is not ended in the this specific code. But other than this, it still doesn't work.
Could you perhaps tell me how the sound and the image files should be called? For example (for the first image and sound):
sound1.wav
img1.gif
img1on.gif
img1off.gif
Just can't figure out why it doesn't work.
t.i.a.,
peter
Length:
Too long
Comments:
Hello., The Below code works in Both IE and Netscape.
<script language="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>
<a href="anklet.htm" onMouseOut="ChangeImageOver('l1')" onMouseOver="ChangeImage('l1');MM_controlSound('play','document.CS993792961750','Laser.wav')">
<body>
</body>