Javascript DOM onloadeddata Event via HTML Tag onloadeddata function

Introduction

In JavaScript:

object.onloadeddata = function(){
       myScript};

This example uses the HTML DOM to assign an "onloadeddata" event to a video element.

View in separate window

<!DOCTYPE html>
<html>
<body>
<video controls id="myVideo">
  <source src="video.mp4" type="video/mp4">
  <source src="video.ogg" type="video/ogg">
  Your browser does not support HTML5 video.
</video>//from  w  ww  .  j a  v a 2 s  .co m
<p id="demo"></p>
<script>
document.getElementById("myVideo").onloadeddata = function() {myFunction()};

function myFunction() {
  document.getElementById("demo").innerHTML = "Browser has loaded the current frame";
}
</script>

</body>
</html>
Bubbles: No
Cancelable: No
Event type: Event
Supported HTML tags: <audio> and <video>



PreviousNext

Related