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 onloadstart Event</h2> <p>Use the addEventListener() method to attach a "loadstart" event to a video element.</p> <video controls id="myVideo"> <source src="mov_bbb.mp4" type="video/mp4"> <source src="mov_bbb.ogg" type="video/ogg"> Your browser does not support video playback. </video> <p id="demo">Event has fired: </p> <p>Video courtesy of <a href="https://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p> <script> document.getElementById("myVideo").addEventListener("loadstart", myFunction); function myFunction() { document.getElementById("demo").innerHTML += "Starting to load video"; } </script> </body> </html>