1.0.2 video视频标签

1.0.2 视频
HTML5 规定了一种通过 video 元素来包含视频的标准方法。

--源代码:video.html
<html>
<body>
<video src="movie.ogg" controls="controls" width="320" height="240">
Your browser does not support the video tag.
</video>
<body>
<html>

IE8不支持video元素。在 IE 9 中,将提供对使用 MPEG4 的 video 元素的支持。







==============================================
<video> - 使用 DOM 进行控制:
--源码 \source\html5\video.html

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function playPause()
{
var myVideo=document.getElementById("video1");
if (myVideo.paused){
myVideo.play();
}
else{
myVideo.pause();
}

}

function makeBig(){
var myVideo=document.getElementById("video1");
myVideo.width=520;
}

function makeNormal(){
var myVideo=document.getElementById("video1");
myVideo.width=420;
}

function makeSmall(){
var myVideo=document.getElementById("video1");
myVideo.width=320;
}
</script>
</head>
<body>

<div style="text-align:center;">
  <button onclick="playPause()">播放/暂停</button>
  <button onclick="makeBig()">大</button>
  <button onclick="makeNormal()">中</button>
  <button onclick="makeSmall()">小</button>
  <br />
  <video id="video1" width="420" style="margin-top:15px;">
    <source src="mov_bbb.mp4" type="video/mp4" />
    <source src="movie.ogg" type="video/ogg" />
    Your browser does not support HTML5 video.
  </video>
</div>



</body>
</html>




         @dianxinxinxiyuan.xiuyanxilu.pudongqu.shanghai

猜你喜欢

转载自listen-raining.iteye.com/blog/2273951