如何使用 html5
知道如何执行以下操作吗?
<video src="video1.ogv" id="ve1" controls>
Your browser does not support HTML5 video.
</video>
<video src="video1.ogv" id="ve2" controls>
Your browser does not support HTML5 video.
</video>
<button onclick="document.getElementById('ve1').play()">
Play</button>
我有两个视频,id 分别为“ve1”和“ve2”。目前,上面的按钮代码将在按下时启用“ve1”上的播放!启用两个视频播放的任何简单方法。我尝试更改按钮标签内的代码,但尚未成功。
any idea how to carry out the following?
<video src="video1.ogv" id="ve1" controls>
Your browser does not support HTML5 video.
</video>
<video src="video1.ogv" id="ve2" controls>
Your browser does not support HTML5 video.
</video>
<button onclick="document.getElementById('ve1').play()">
Play</button>
I have two videos with id's 've1' and 've2' respectively. At the moment the code above for the button will enable play on 've1' when pressed! Any simple way of enabling play on both videos. I have tried altering the code within the button tag with no success as of yet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以简单地将
onclick
值更改为:但将其移动到一个单独的 JavaScript 函数中可能会更清晰,该函数设置播放并调用:
并且:
You could simply change the
onclick
value to:But it might be cleaner to move it into a separate JavaScript function which sets the play going and calls that:
And: