Anchor type 属性

Anchor 对象参考手册 Anchor对象

定义和用法

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

type 属性描述了链接文档的 MIME 类型。

语法

设置 type 属性:

anchorObject.type="MIME-type"

返回 type 属性:

anchorObject.type

描述
MIME-type 描述链接文档的 MIME 类型。 更多关于 MIME 类型请查看 IANA MIME types


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 type 属性


实例

实例

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

<html>
<body>

<p><a id="w3s" type="text/html"
href="//www.techbrood.com">W3Schools</a></p>

<script>
document.write(document.getElementById("w3s").type);
</script>

</body>
</html>

以上实例输出结果:

text/html

尝试一下 »


Anchor 对象参考手册 Anchor对象