编辑下面的代码:【加编码】
<html> <body> <video id="myVideo" width="320" height="240" controls> <source src="movie.mp4" type="video/mp4"> <source src="movie.ogg" type="video/ogg"> 您的浏览器不支持 video 标签。 </source></source></video><br> <button onclick="getCurTime()" type="button">获取当前时间点</button> <button onclick="setCurTime()" type="button">设置时间位置为5秒</button> <script> var x = document.getElementById("myVideo"); function getCurTime() { alert(x.currentTime); } function setCurTime() { x.currentTime = 5; } </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂