具体代码实现
<!--video定义声音 ; controls控制器(播放,暂停,音量调整)-->
<!-- <video src="../music/wo.mp3" controls="controls">你的浏览器不支持</video>-->
<!-- 用按钮来替换控制器!controls-->
<button onclick="fun()">播放/暂停</button>
<!-- 放大 -->
<button onclick="fun1()">放大</button>
<!-- 缩小 -->
<button onclick="fun2()">缩小</button><br/>
<video id="video">
<!-- <video id="video" height="500" width="800">-->
<!--<video controls="controls">-->
<!-- source 指定多媒体资源,可以是多个 -->
<source src="../music/baby.mp4">
<source src="../music/wo.ogg">
你的浏览器不支持
</video>
<script type="text/javascript">
//获得视频
// 对象
var v=document.getElementById("video");
function fun(){
if(v.paused){
v.play(); //播放
}else{
v.pause(); //暂停
}
}
//big
function fun1(){
v.width=600;
v.height=600;
}
//small
function fun2(){
v.width=300;
v.height=300;
}
</script>
效果
(1)单击播放/暂停
(2)单击放大
(3)单击缩小