+ 12
How To Play And Pause Audio With Javascript Onclick event
3 odpowiedzi
+ 14
<button onclick=
'var a = document.getElementsByTagName("audio")[0];
if(a.paused)a.play();else a.pause()'>Play/Pause</button>
<audio src="file:///sdcard/Sora-sound.mp3"
></audio>
//Didn't test yet
Pause audio element with .pause()
play audio element with .play()
//More:
In The mobile browser. Audio is often played when onclick is fired
+ 6
paused is property that return boolean. if audio is currently stop or not playing. This property return true
.play() and .paused() are the function of audio element
but checked....checked is attribute for <input> isn't it?
+ 5
Ok Thanks