HTMLAnchorElement: type 屬性
HTMLAnchorElement 介面的 type 屬性是一個字串,表示連結資源的 MIME 型別。
它反映了 <a> 元素的 type 屬性。
值
字串。
示例
html
<a id="exampleLink" href="https://example.com" type="text/html">Example Link</a>
<p class="type"></p>
css
#exampleLink {
font-size: 1.5rem;
}
js
const anchorElement = document.getElementById("exampleLink");
const pTag = document.querySelector(".type");
console.log(anchorElement.type); // Output: "text/html"
pTag.textContent = anchorElement.type;
規範
| 規範 |
|---|
| HTML # dom-a-type |
瀏覽器相容性
載入中…