jaiantbass
01-08-2009, 06:26 AM
So I have been trying to use this script by John Sheuer for bg music. It works great except in IE. I have tried a hundred different ways, but can't seem to get it working in IE. I have looked back through the other threads on the subject to no avail. Any help out there?
Here is what I have:
<script type="text/javascript">
/*Toggle Sound Script © John Davenport Scheuer
as first seen in www.dynamicdrive.com/forums (user name:
jscheuer1). Visit http://www.dynamicdrive.com for 100's
of DHTML scripts. This credit must remain for legal use.
*/
var sndEl="HomePage/Mixdown.mp3" //Set to name and path of your sound file
function toggleSound(){
if (document.all&&document.all.sound&&document.all.sound.src!=='')
document.all.sound.src=''
else if (document.getElementById&&document.getElementById('snd')){
sndEl=document.getElementById('snd')
document.getElementById('sndC').removeChild(sndEl)
}
else if (document.all&&document.all.sound&&document.all.sound.src=='')
document.all.sound.src=sndEl
else if (document.getElementById)
document.getElementById('sndC').appendChild(sndEl)
}
</script>
<script type="text/javascript">
if(document.getElementById&&!document.getElementById('sound')){
document.write('<div id="sndC" style="position:absolute;top:-1000px:left:-1000px;visibility:hidden;">')
document.write('<embed id="snd" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" Name="MediaPlayer" src="'+sndEl+'" AUTOSTART="true" hidden="true" loop="true">')
document.write('</div>')
}
document.write('<input type="image" class="centerd" src="HomePage/Music.gif" onclick="toggleSound();">')
</script>
Thanks,
Andrew
Here is what I have:
<script type="text/javascript">
/*Toggle Sound Script © John Davenport Scheuer
as first seen in www.dynamicdrive.com/forums (user name:
jscheuer1). Visit http://www.dynamicdrive.com for 100's
of DHTML scripts. This credit must remain for legal use.
*/
var sndEl="HomePage/Mixdown.mp3" //Set to name and path of your sound file
function toggleSound(){
if (document.all&&document.all.sound&&document.all.sound.src!=='')
document.all.sound.src=''
else if (document.getElementById&&document.getElementById('snd')){
sndEl=document.getElementById('snd')
document.getElementById('sndC').removeChild(sndEl)
}
else if (document.all&&document.all.sound&&document.all.sound.src=='')
document.all.sound.src=sndEl
else if (document.getElementById)
document.getElementById('sndC').appendChild(sndEl)
}
</script>
<script type="text/javascript">
if(document.getElementById&&!document.getElementById('sound')){
document.write('<div id="sndC" style="position:absolute;top:-1000px:left:-1000px;visibility:hidden;">')
document.write('<embed id="snd" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" Name="MediaPlayer" src="'+sndEl+'" AUTOSTART="true" hidden="true" loop="true">')
document.write('</div>')
}
document.write('<input type="image" class="centerd" src="HomePage/Music.gif" onclick="toggleSound();">')
</script>
Thanks,
Andrew