html5 - play/pause button in javascript, when audio is defined in javascript -
How to create a play / pause button in the following javascript and html.
javascript:
var audio = new audio (); Audio src = 'track.mp3'; Audio.controls = True; Audio.loop = True; Audio.autoplay = true; Function aud_play_pause () {var audio = document.getElementById ("audio"); If (audio paused) {audio.play (); } Else {audio.pause (); }}
html:
& lt; Button type = "button" onclick = "aud_play_pause ()" & gt; Play / pause & lt; / Button & gt;
Comments
Post a Comment