<body>
<div style="text-align:center">
<button οnclick="playPause()">播放/暂停</button>
<button οnclick="makeBig()">放大</button>
<button οnclick="makeSmall()">缩小</button>
<button οnclick="makeNormal()">普通</button>
<br>
<video id="video1" width="420" controls><!-- control 属性供添加播放、暂停和音量控件-->
<source src="xxx.mp4" type="video/mp4">
<source src="xxx.ogg" type="video/ogg">
您的浏览器不支持 HTML5 video 标签。
</video><!--这个是视频-->
var myVideo=document.getElementById("video1");
function playPause()
{
if (myVideo.paused)
myVideo.play(); //当他暂停的时候,点击,开始播放,否则暂停
else
myVideo.pause(); //调用的是play和pause函数
}
function makeBig()
{
myVideo.width=560;
}
function makeSmall()
{
myVideo.width=320;
}
function makeNormal()
{
myVideo.width=420;
}
</script>
</body>
</html>
<div style="text-align:center">
<button οnclick="playPause()">播放/暂停</button>
<button οnclick="makeBig()">放大</button>
<button οnclick="makeSmall()">缩小</button>
<button οnclick="makeNormal()">普通</button>
<br>
<video id="video1" width="420" controls><!-- control 属性供添加播放、暂停和音量控件-->
<source src="xxx.mp4" type="video/mp4">
<source src="xxx.ogg" type="video/ogg">
您的浏览器不支持 HTML5 video 标签。
</video><!--这个是视频-->
</div>
<audio controls><!--这是音频-->
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
您的浏览器不支持 audio 元素。
</audio>
var myVideo=document.getElementById("video1");
function playPause()
{
if (myVideo.paused)
myVideo.play(); //当他暂停的时候,点击,开始播放,否则暂停
else
myVideo.pause(); //调用的是play和pause函数
}
function makeBig()
{
myVideo.width=560;
}
function makeSmall()
{
myVideo.width=320;
}
function makeNormal()
{
myVideo.width=420;
}
</script>
</body>
</html>