HTMLAreaElement: toString() 方法
HTMLAreaElement.toString() 字串化 方法返回一個包含完整 URL 的字串。它是 HTMLAreaElement.href 的只讀版本。
語法
js
toString()
引數
無。
返回值
一個包含元素完整 URL 的字串。
示例
在 area 元素上呼叫 toString
js
// An <area id="myArea" href="/en-US/docs/HTMLAreaElement"> element is in the document
const area = document.getElementById("myArea");
area.toString(); // returns 'https://mdn.club.tw/en-US/docs/HTMLAreaElement'
規範
| 規範 |
|---|
| HTML # dom-hyperlink-href-dev |
瀏覽器相容性
載入中…
另見
- 它所屬的
HTMLAreaElement介面。