Anchor type 属性

定义和用法
type 属性可设置或返回被链资源的 MIME 类型。
type 属性描述了链接文档的 MIME 类型。
语法
设置 type 属性:
anchorObject.type="MIME-type"
返回 type 属性:
anchorObject.type
值 | 描述 |
---|---|
MIME-type | 描述链接文档的 MIME 类型。 更多关于 MIME 类型请查看 IANA MIME types |
浏览器支持
所有主要浏览器都支持 type 属性
实例
实例
下面的例子可返回被链资源的 MIME 类型:
<p><a id="runoob" type="text/html" href="//www.uoften.com">悠悠之家</a></p>
<script>
document.write("返回链接的type属性值:");
document.write(document.getElementById("runoob").type);
</script>
以上实例输出结果:
text/html
