Jenis properti HTML DOM Jangkar
Definisi dan Penggunaan
ketik set properti atau mengembalikan tipe MIME dari rantai sumber daya.
Jenis atribut menggambarkan tipe MIME dari dokumen terkait.
tatabahasa
Jenis pengaturan atribut:
anchorObject.type="MIME-type"
Pengembalian ketik atribut:
anchorObject.type
值 | 描述 |
---|---|
MIME-type | 描述链接文档的 MIME 类型。 更多关于 MIME 类型请查看 IANA MIME types |
Dukungan Browser
Semua browser utama mendukung atribut Jenis
contoh
contoh
Contoh berikut mengembalikan tipe MIME dari sumber daya terkait:
<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>
Contoh output di atas:
text/html
Coba »
objek anchor