W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <button onclick="enableLoop()" type="button">启用循环</button> <button onclick="disableLoop()" type="button">禁用循环</button> <button onclick="checkLoop()" type="button">检查循环的状态</button> <br /> <br /> <video id="video1" controls="controls"> <source src="/example/html5/mov_bbb.mp4" type="video/mp4"> <source src="/example/html5/mov_bbb.ogg" type="video/ogg"> Your browser does not support HTML5 video. </video> <script> myVid=document.getElementById("video1"); function enableLoop() { myVid.loop=true; myVid.load(); } function disableLoop() { myVid.loop=false; myVid.load(); } function checkLoop() { alert(myVid.loop); } </script> </body> </html>