mute and unmute button toggle html5 audio
问题 I've understood how to mute an <audio> sound object by putting this code : <a href="#" onclick="document.getElementById('ambiance').muted = true; return false"> mute sound </a> Now I'm searching how to mute/unmute my sound using the same button with the option to toggle it ? Can anyone give me directions? 回答1: var audioElm = document.getElementById('ambiance'); audioElm.muted = !audioElm.muted; 回答2: Try this: .unmute { background-image: url(http://franriavilla.in/images/unmute.png);