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

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -