[學習筆記]今天開始學HTML5!

1,href和src的區別:href有「鏈接,引用」之意,指二者的鏈接關係,如<a href=""></a>,<link href="**.css"/>;javascript

          src有「獲取」之意,指拿來使用,如<img src="./**.jpg"/>。css

 

2,HTML5標籤html

1>,<video>,視頻標籤,僅支持ogg,mpeg4,webm格式視頻html5

<video scr="' width="" height="" controls="controls"></video>支持寬,高,開始暫停音量控件;java

<video>web

  <source src="**.ogg" type="video/ogg">瀏覽器

  <source src="**.mp4" type="video/mp4">ide

Your browser does not support the video tag.spa

</video>若有多個視頻來源,source標籤引用多個視頻來源,瀏覽器選擇支持的格式,當瀏覽器不支持video標籤是,顯示內部文本。code

video支持DOM控制,提供play(),pause()方法,提供屬性paused

<!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="video1" width="420" style="margin-top:15px;">
    <source src="/example/html5/mov_bbb.mp4" type="video/mp4" />
    <source src="/example/html5/mov_bbb.ogg" type="video/ogg" />
    Your browser does not support HTML5 video.
  </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>

 

2>,<audio>音頻標籤,用法類比<video>

3>,html5好難啊。。。

相關文章
相關標籤/搜索