html5 video播放/暂停开关


<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html;charset=utf8">
<head>
<title>html5 video播放/暂停开关</title>
</head>
<body>
<div style="text-align:center">
<button onclick="playPause()">播放/暂停</button>
<br />
<video id="video1" width="420">
<source src="http://www.runoob.com/try/demo_source/mov_bbb.mp4" type="video/mp4">
</video>

</div>

<script type="text/javascript">
var myVideo = document.getElementById("video1");
function playPause()
{
if(myVideo.paused)
myVideo.play();
else
myVideo.pause();
//myVideo.stop();
}

</script>
</body>
</html>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM