Latest web development tutorials

HTML DOM Area search 屬性

Area 對象參考手冊 Area對象

定義和用法

search 屬性設置或者返回href 屬性值的查詢字符串部分。

語法

areaObject.search=querystring


瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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


實例

實例

下面的例子可返回"Venus" 中的link-URL 的查詢字符串部分:/p>

<!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?id=venus">
</map>
<p>金星区域的查询字符串部分:
<script>
document.write(document.getElementById('venus').search);
</script>
</p>

</body>
</html>

以上實例輸出結果:

金星区域的查询字符串部分: ?id=venus

嘗試一下»


Area 對象參考手冊 Area對象