Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h1>HTML DOM Events</h1> <h2>The onplaying Event</h2> <p>Assign an "onplaying" event to an audio element.</p> <audio controls onplaying="myFunction()"> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio> <p>Play, pause and then play the audio again.</p> <p id="demo"></p> <script> function myFunction() { document.getElementById("demo").innerHTML += "The audio is playing"; } </script> </body> </html>