Mute button for background music

M

mal1003

I have a background song on my frontpage homepage and wanted to know if I
could create a mute button for viewers to click on. If so, do you know how
and what the code is. Thanks for you help.
 
A

Andrew Murray

No I don't know the code; but a user could always use the mute button on
their keyboard.
 
T

Trevor L.

mal1003 said:
I have a background song on my frontpage homepage and wanted to know
if I could create a mute button for viewers to click on. If so, do
you know how and what the code is. Thanks for you help.

You could try this
<span id="sound"></span>
<input type="button" value="Play/Stop
Music" onclick="playSound()"/>
where
function playSound(fname)
{
if (!fname)
fname = "audio/minuet.mid"
var x = document.getElementById("sound")
x.innerHTML = (!x.innerHTML ) ? '<embed src="' + fname + '" loop=false
autostart=true hidden>' : ''
}

Clicking the button will start or stop the music
It isn't quite a mute, because clicking again restarts the music, but it is
fairly close
 
C

chris

the simple solution would seem to me not to use a BG sound tag which is
IE only but to use an embed tag with a visible controller.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top