编辑下面的代码:【加编码】
<html> <body> <button onclick="getVolume()" type="button">What is the volume?</button> <button onclick="setHalfVolume()" type="button">Set volume to 0.2</button> <button onclick="setFullVolume()" type="button">Set volume to 1.0</button> <br> <video id="video1" controls="controls"> <source src="mov_bbb.mp4" type="video/mp4"> <source src="mov_bbb.ogg" type="video/ogg"> Your browser does not support HTML5 video. </source></source></video> <script> myVid=document.getElementById("video1"); function getVolume() { alert(myVid.volume); } function setHalfVolume() { myVid.volume=0.2; } function setFullVolume() { myVid.volume=1.0; } </script> <p>Video courtesy of <a href="http://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂