 Anchor对象
 Anchor对象定义和用法
type 属性可设置或返回被链资源的 MIME 类型。
type 属性描述了链接文档的 MIME 类型。
语法
设置 type 属性:
 anchorObject.type="MIME-type" 
返回 type 属性:
 anchorObject.type 
| 值 | 描述 | 
|---|---|
| MIME-type | 描述链接文档的 MIME 类型。 更多关于 MIME 类型请查看 IANA MIME types | 
浏览器支持





所有主要浏览器都支持 type 属性
实例
实例
下面的例子可返回被链资源的 MIME 类型:
 <html>
<body>
<p><a id="w3s" type="text/html"
href="https://www.zqxt.cn">ZiQiangXueTang</a></p>
<script>
document.write(document.getElementById("w3s").type);
</script>
</body>
</html>
<body>
<p><a id="w3s" type="text/html"
href="https://www.zqxt.cn">ZiQiangXueTang</a></p>
<script>
document.write(document.getElementById("w3s").type);
</script>
</body>
</html>
以上实例输出结果:
 text/html
尝试一下 »
 Anchor对象
 Anchor对象
