Latest web development tutorials

HTML DOM Area hash 屬性

Area 對象參考手冊 Area對象

定義和用法

hash 屬性克設置或者返回href 屬性值得錨部分。

語法

areaObject.hash=anchorname


瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要瀏覽器都支持hash 屬性


實例

實例

下面的例子可返回"Venus" 區域中href屬性的錨部分:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.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#description">
</map>
<p>金星href属性的锚:
<script>
document.write(document.getElementById("venus").hash);
</script>
</p>

</body>
</html>

以上實例輸出結果:

金星href属性的锚: #description

嘗試一下»


Area 對象參考手冊 Area對象