HTML DOM type 属性

定义和用法

type 属性可设置或返回被链资源的 MIME 类型。

语法

  1. anchorObject.type=type

实例

下面的例子可返回被链资源的 MIME 类型:

  1. <html>
  2. <body>
  3.  
  4. <p><a id="myAnchor" type="text/html"
  5. href="http://www.baidu.com">baidu.com</a></p>
  6.  
  7. <script type="text/javascript">
  8. x=document.getElementById("myAnchor");
  9. document.write(x.type);
  10. </script>
  11.  
  12. </body>
  13. </html>