revision:
The ontimeupdate attribute defines a script to run when the playing position of an audio/video has changed.
The ontimeupdate attribute is part of the event attributes, and can be used on the following elements: <audio> and <video>.
This event is invoked by playing the audio/video and moving the playback position (like when the user fast forwards to a different point in the audio/video)
<element ontimeupdate="script"></element>
script: the script to be run on ontimeupdate.
example
Move to a new position in the audio:
codes:
<p class="spec" id="demo">Move to a new position in the audio:</p> <audio style="margin-left:3vw;" id="myAudio" controls ontimeupdate="audioFunction()"> <source src="../../pics/horse.wav" type="audio/wav"> Your browser does not support the audio element. </audio> <script> function audioFunction() { document.getElementById("demo").innerHTML = "You moved to position " + document. getElementById("myAudio").currentTime; } </script>
example
Move to a new position in the video:
HTML codes:
<p class="spec" id="demo-1">Move to a new position in the video:</p> <video style="margin-left:3vw;" id="myVideo" width="320" height="176" controls ontimeupdate= "videoFunction()"> <source src="../../pics/Wuzhen-20-10_02.mp4" type="video/mp4"> Your browser does not support HTML5 video. </video> <script> function videoFunction() { document.getElementById("demo-1").innerHTML = "You moved to position " + document.getElementById("myVideo").currentTime; } </script>
The ontoggle attribute fires when the user opens or closes a <div> element. The <div> element specifies additional div that the user can view or hide on demand.
The ontoggle attribute is part of the event attributes and can be used on the following element: <div>.
<element ontoggle="script></element>
script: this attribute contains single value script which works when the ontoggle event is called.
example
Open the div.
Copyright 1999-2014.
- by ... . All Rights Reserved.
All content and graphics on this web site are the property of . . . . .
codes:
<p class="spec">Open the div.</p> <div style="margin-left:3vw;" ontoggle="myDetails()"> <p>Copyright 1999-2014.</p> <p class="spec"> - by ... . All Rights Reserved.</p> <p class="spec">All content and graphics on this web site are the property of . . . . .</p> </div> <script> function myDetails() { alert("The ontoggle event occured"); } </script>
example
Click below to open the div.
What is the full form of HTML
Hyper Text Markup Language
codes:
<p class="spec">Click below to open the div.</p> <div style="margin-left:3vw;" ontoggle="more()"> <p style="color:blue";>What is the fullform of HTML</p> <p class="spec">Hyper Text Markup Language</p> </div> <script> function more() { alert("The ontoggle event triggered"); } </script>