HTML DOM教程 37-HTML DOM Meta 對象

來源:互聯網
上載者:User

HTML DOM教程 37-HTML DOM Meta 對象

 

  1:Meta 對象

  Meta 對象代表 HTML 的 一個 <meta> 元素。

  <meta> 元素可提供有關某個 HTML 元素的元資訊 (meta-information),比如描述、針對搜尋引擎的關鍵詞以及重新整理頻率。

  2:Meta Object Properties
屬性 描述 IE F O W3C
content 設定或返回 <meta> 元素的 content 屬性的值。 5 1 9 Yes
httpEquiv 把 content 屬性串連到一個 HTTP 頭部。 5 1 9 Yes
name 把 content 屬性串連到某個名稱。 5 1 9 Yes
scheme 設定或返回用於解釋 content 屬性的值的格式。 6 1 9 Yes

 

  3:scheme 屬性

  本例返回用於解釋 content 屬性的值的格式:

<html>

<head>
<meta name="revised" content="2006-11-03" scheme="YYYY-MM-DD" />
</head>
<body>

<script type="text/javascript">
x=document.getElementsByTagName("meta")[0];
document.write("Content format: " + x.scheme);

</script>

</body>

</html>

4:讓頁面5秒後重新導向

 

<html>

<head>
<meta http-equiv="refresh" content="5;url=http://www.w3school.com.cn" />
</head>
<body>
<script type="text/javascript">
x=document.getElementsByTagName("meta")[0];
document.write("Http equiv: " + x.httpEquiv);

</script>
<p>We have moved! The new URL is: <a href="http://www.w3school.com.cn">http:      //www.w3school.com.cn</a></p>
<p>You will be redirected to the new address in five seconds. If you see this message for more than 5 seconds, please click on the link above.</p>

</body>

</html>

5:讓頁面每5秒鐘重新整理一次

<html>

<head>
<meta http-equiv="refresh" content="5" />
</head>
<body>
<script type="text/javascript">
x=document.getElementsByTagName("meta")[0];
document.write("Http equiv: " + x.httpEquiv);
</script>

</body>

</html>


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.