HTML5

强大而灵活的html5标签,今天学习了一下<video>标签,对以后写视频展示类的网站应该很有帮助,以下是w3cschool中的部分实例代码:

<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html;charset=utf8">
<head>
	
</head>
<body>
	<div style="text-align:center">
		<button onclick="playPause()">播放/暂停</button>
		<button onclick="makeBig()">放大</button>
		<button onclick="makeSmall()">缩小</button>
		<button onclick="makeNormal()">普通</button>
		<br />
		<video id="video1" width="420">
			<source src="http://www.runoob.com/try/demo_source/mov_bbb.mp4" type="video/mp4">
		</video>
		
	</div>

	<script type="text/javascript">
		var myVideo = document.getElementById("video1");
		function playPause()
		{
			if(myVideo.paused)
				myVideo.play();
			else
				myVideo.pause();
		}
		function makeBig(){
			myVideo.width=560;
		}
		function makeSmall()
		{
			myVideo.width=320;
		}
		function makeNormal(){
			myVideo.width=420;
		}
	</script>
</body>
</html>


<video>定义一个视频;

<source>定义多种媒体资源。

定义音频:

<div style="text-align:center">
		<audio controls>
			<source src="http://www.runoob.com/try/demo_source/horse.mp3" type="audio/mpeg">
		</audio>
	</div>



你可能感兴趣的:(HTML5