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 类型:

<p><a id="icodebang" type="text/html" href="//www.icodebang.com">本站教程</a></p>
<script>
document.write("返回链接的type属性值:");
document.write(document.getElementById("icodebang").type);
</script>

以上实例输出结果:

text/html

尝试一下 »


Anchor 对象参考手册 Anchor对象

0 个评论

要回复文章请先登录注册