
Area 對象
hostname 屬性可設定或傳回 href 屬性值得主機名部分。
areaObject.hostname=hostname
所有主要浏覽器都支援 hostname 屬性
下面的例子可傳回圖像映射中 "Venus" 區域的主機名:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鳥教程(runoob.com)</title>
</head>
<body>
<img loading="lazy" src="planets.gif" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">
</map>
<p>Venus 區域的主機名稱:
<script>
document.write(document.getElementById('venus').hostname);
</script>
</p>
</body>
</html>
以上執行個體輸出結果:
Venus 區域的主機名稱: www.runoob.com
