代码编辑器:
x
1
<button onclick="getCurTime()" type="button">获得当前时间的位置</button>
2
<button onclick="setCurTime()" type="button">将时间位置设置为 5 秒</button>
3
<br>
4
<video id="video1" controls="controls">
5
<source src="/static/i/html/html_video_1.mp4" type="video/mp4">
6
<source src="/static/i/html/html_video_1.ogg" type="video/ogg">
7
您的浏览器不支持 HTML5 video 标签。
8
</video>
9
10
<script>
11
myVid=document.getElementById("video1");
12
function getCurTime()
13
{
14
alert(myVid.currentTime);
15
}
16
function setCurTime()
17
{
18
myVid.currentTime=5;