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>



相关文章:

  • 2021-08-01
  • 2022-02-21
  • 2021-06-03
  • 2021-08-16
  • 2021-06-28
  • 2021-12-08
  • 2021-12-12
  • 2021-12-24
猜你喜欢
  • 2021-10-22
  • 2021-11-07
  • 2021-08-25
  • 2021-07-10
  • 2021-06-03
  • 2021-06-14
  • 2021-12-04
相关资源
相似解决方案