HTML DOM Area 對象

Area 對象

Area 對象代表 HTML <area> 元素。

訪問 Area 對象

您可以使用 getElementById() 訪問 <area> 元素:

var x = document.getElementById("myArea");

親自試一試

創建 Area 對象

您可以使用 document.createElement() 方法創建 <area> 元素:

var x = document.createElement("AREA");

親自試一試

Area 對象屬性

屬性 描述
alt 設置或返回區域的 alt 屬性值。
coords 設置或返回區域的 coords 屬性值。
hash 設置或返回 href 屬性值的錨部分。
host 設置或返回 href 屬性值的主機名和端口部分。
hostname 設置或返回 href 屬性值的主機名部分。
href 設置或返回區域的 href 屬性值。
noHref

HTML5 中不支持。

設置或返回區域的 nohref 屬性值。

origin 返回 href 屬性值的協議、主機名和端口部分。
password 設置或返回 href 屬性值的密碼部分。
pathname 設置或返回 href 屬性值的路徑名部分。
port 設置或返回 href 屬性值的端口部分。
protocol 設置或返回 href 屬性值的協議部分。
search 設置或返回 href 屬性值的查詢字符串部分。
shape 設置或返回區域的 shape 屬性值。
target 設置或返回區域的 target 屬性值。
username 設置或返回 href 屬性值的用戶名部分。

標準屬性和事件

Area 對象同時支持標準屬性事件

相關頁面

HTML 參考手冊:HTML <area> 標簽