Area hostname 屬性

Area 對象參考手冊 Area 對象

定義和用法

hostname 屬性可設置或返回 href 屬性值得主機名部分。

語法

areaObject.hostname=hostname


流覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要流覽器都支持 hostname 屬性


實例

實例

下麵的例子可返回圖像映射中 "Venus" 區域的主機名:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>IT研修(xuhuhu.com)</title>
</head>
<body>

<img 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.xuhuhu.com



Area 對象參考手冊 Area 對象