javascript - How to mute & un-mute a player button? -
I am trying to create a player who tries to mute my player without mute . For some reason I can only mute but can not mute the player. The same function works fine with play / pause button ... does anyone have any edged?
& lt; Html & gt; & Lt; Top & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Input type = 'button' onclick = "mute_enumut ()" value = 'mute' class = "btn_rendem" id = "muteum" /> & Lt; Audio control = "control" preload autoplay = "autoplay" id = "audio 1" volume = "1.0" & gt; & Lt; / Audio & gt; & Lt; Script type = "text / javascript" & gt; Function MuteUnmut () {var MuteSound = document.getElementById ("audio1"); x = new boolean (mutusound.moot = false); If (x) {document.getElementById ('audio1'). Mute = true; . Document.getElementById ("muteunmute") value = "United Nations Mute"; } And {document.getElementById ('audio1'). Volume = "1.0"; . Document.getElementById ("muteunmute") value = "mute"; }} & lt; / Script & gt; & Lt; / Body & gt; Thanks!
You can only reduce your function:
function Mute unit () {document.getElementById ('audio1'). Mute =! Document. GetElementById ('audio1'). Mute; document.getElementById ("Mutemoot"). Value = (document.getElementById ("Mutemoot"). Value == "Mute")? "Un-Mute": "Mute"; }
Comments
Post a Comment