简单教程
提交运行
代码编辑器:
<video id="myVideo" controls src="/static/i/html/html_video_1.ogg"> 您的浏览器不支持 video 标签。 </video> <p>点击按钮修改视频的 URL</p> <p id="demo"></p> <button onclick="myFunction()">点我</button> <script> var x = document.getElementById("myVideo"); function myFunction(){ isSupp = x.canPlayType("video/mp4"); if (isSupp == ""){ x.src = "/static/i/html/html_video_2.ogg"; }else{ x.src = "/static/i/html/html_video_2.mp4"; } x.load(); document.getElementById("demo").innerHTML = "Video Courtesy of Big Buck Bunny - www.bigbuckbunny.org"; } </script>
运行结果: