CSS Portal
Run
Search
« Back to
HTML onplay Event Attribute
<!DOCTYPE HTML> <html> <body> <audio id="myAudio" controls onplay="myFunction()"> <source src="audio.mp3" type="audio/mpeg"> Your browser does not support the audio tag. </audio> <p>Play sound file.</p> <script> function myFunction() { alert("EXAMPLE: audio file is playing."); } </script> <p>This example shows how to use the onplay attribute for an AUDIO element.</p> </body> </html>