Javascript examples for DOM Event:Element Event Attribute
The onended event occurs when the audio/video has reached the end.
Bubbles | No |
---|---|
Cancelable | No |
Supported HTML tags: | <audio> and <video> |
<!DOCTYPE html> <html> <body> <audio id="myAudio" controls> <source src="your.ogg" type="audio/ogg"> <source src="your.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio>//from w w w .jav a 2 s . c o m <p id="demo"></p> <script> document.getElementById("myAudio").onended = function() {myFunction()}; function myFunction() { document.getElementById("demo").innerHTML = "The audio has ended."; } </script> </body> </html>