菜鸟学堂
在线运行
源代码
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟学堂</title> </head> <body> <button onclick="enableAutoplay()" type="button">启动自动播放</button> <button onclick="disableAutoplay()" type="button">禁用自动播放</button> <button onclick="checkAutoplay()" type="button">检查自动播放状态</button> <br> <video id="video1" controls="controls"> <source src="mov_bbb.mp4" type="video/mp4"> <source src="mov_bbb.ogg" type="video/ogg"> 您的浏览器不支持 HTML5 video 标签。 </video> <script> myVid=document.getElementById("video1"); function enableAutoplay() { myVid.autoplay=true; myVid.load(); } function disableAutoplay() { myVid.autoplay=false; myVid.load(); } function checkAutoplay() { alert(myVid.autoplay); } </script> <p>Video courtesy of <a href="http://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p> </body> </html>
运行结果
在线运行
菜鸟学堂 edu.jb51.net