HTML是超文本标记语言,是一种专门用来制作网页的语言,而HTML5就是它的第五个版本,2014年10月29日,万维网联盟宣布,经过接近8年的艰苦努力,该标准规范终于制定完成,该标准针对当前互联网的飞速发展制定了更加标准的网页语言规范及适用功能,同时也给我们开发者带来了更多的开发选择,学习它是每个前端开发者必修的课程。
<!DOCTYPE html> <html> <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="video" width="420" style="margin-top:15px;"> <source src="/upload/video/video_example.mp4" type="video/mp4" /> <source src="/upload/video/video_example.ogg" type="video/ogg" /> 您的浏览器不支持Video标签 </video> </div> <script type="text/javascript"> var demoVideo=document.getElementById("video"); //使用DOM获取video对象 function playPause() { if (demoVideo.paused) //读取video播放状态属性 demoVideo.play(); //调用video的方法,开始播放 else demoVideo.pause(); //调用video的方法,暂停播放 } function makeBig() { demoVideo.width=560; //设置video宽度属性 } function makeSmall() { demoVideo.width=320; } function makeNormal() { demoVideo.width=420; } </script> </body> </html>
属性 | 方法 | 事件 |
---|---|---|
currentSrc | play() | play |
currentTime | pause() | pause |
videoWidth | load() | progress |
videoHeight | error | |
duration | timeupdate | |
ended | ended | |
error | abort | |
paused | empty | |
muted | emptied | |
seeking | waiting | |
volume | loadedmetadata | |
height | ||
width |