HTML DOM Anchor type property
Definition and Usage
type property sets or returns the MIME type of the resource chain.
type attribute describes the MIME type of the linked document.
grammar
Setting type attributes:
anchorObject.type="MIME-type"
Returns type attributes:
anchorObject.type
值 | 描述 |
---|---|
MIME-type | 描述链接文档的 MIME 类型。 更多关于 MIME 类型请查看 IANA MIME types |
Browser Support
All major browsers support attribute type
Examples
Examples
The following example returns the MIME type of the linked resource:
<html>
<body>
<p><a id="w3s" type="text/html"
href="http://www.w3cschool.cc">W3Schools</a></p>
<script>
document.write(document.getElementById("w3s").type);
</script>
</body>
</html>
<body>
<p><a id="w3s" type="text/html"
href="http://www.w3cschool.cc">W3Schools</a></p>
<script>
document.write(document.getElementById("w3s").type);
</script>
</body>
</html>
Examples of the above output:
text/html
try it"
Anchor objects