I was creating a website, I put background music, and my problem is I dont know how to create a button(only one) for mute/unmute the sound. I would like to have a mute button that can mute/unmute depending on the situation(if the music is muted then the button should have the image of a Loudspeaker,for hearing the sound, if you press it then you begin listening the music and the image of the button changes and vice versa)
what I have now is this:
<td width=10% valign="top" align="right">
<img src="images/sonidoON.png" onclick="this.src='images/sonidoOFF.png'" width=30% height=7%>
</td>
I only need to know how to create that button, not the functions for the background music.
Thank you very much in advance
HTML
CSS
JavaScript
http://jsfiddle.net/Ffccv/2/
using :checked pseudo-class selector
You can do this To toggle them
and
onclick="toggleSound(this);"
or create img from script and useaddEventListener ("click",toggleSound())
fiddle demo : http://jsfiddle.net/K9553/