Hello there
I am trying to fix a bug in the following script as the music does not stop in IE 7 if the file is an .mp3 but does in IE 5 +6 and Firefox. I hope you can help. Thank you!
<script type="text/javascript">
var sound2Embed = null;
function init() {
}
function sound2Play() {
if ( !sound2Embed ) {
sound2Embed = document.createElement("embed");
sound2Embed.setAttribute("src", "audio/tequila.mp3");
sound2Embed.setAttribute("hidden", true);
sound2Embed.setAttribute("autostart", true);
} else sound2Stop();
sound2Embed.removed = false;
document.body.appendChild(sound2Embed);
}
function sound2Stop() {
if ( sound2Embed && !sound2Embed.removed ) {
document.body.removeChild(sound2Embed);
sound2Embed.removed = true;
}
}
</script>
<body onload="init();">
<input type="submit" onclick="sound2Play();" name="Play 2" value="Play 2">
<input type="submit" onclick="sound2Stop();" name="Stop 2" value="Stop 2">



Reply With Quote

Bookmarks