Latest web development tutorials

HTML DOM Area noHref 屬性

Area 對象參考手冊 Area對象

定義和用法

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

nohref 屬性指定一個區域沒有相關鏈接.

提示: nohref屬性通知瀏覽器超鏈接屬性不存在。你也可以不使用href 屬性來更簡單的設置沒有相關鏈接。

語法

areaObject.noHref=true|false


瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

除了IE 瀏覽器,所有主流瀏覽器都支持noHref 屬性。


實例

實例

下面的例子可返回圖像映射中"Venus" 區域的"noHref" 屬性:

<html>
<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"
nohref="nohref">
</map>

<p>Value of nohref attribute for the "Venus" area is:
<script>
document.write(document.getElementById("venus").noHref);
</script>
</p>

</body>
</html>

以上實例輸出結果:

Value of nohref attribute for the "Venus" area is: true

嘗試一下»


Area 對象參考手冊 Area對象