Area search attribute

Definition and usage

search Attribute set or return href attribute value The query string part.

href The attribute specifies the destination of the link in the area.

The query string is the part after the question mark (?) in the URL, usually used for parameter transmission.

See also:

JavaScript Reference Manual:location.search attribute

Example

Example 1

Return the URL query string of the specific area in the image map:

var x = document.getElementById("venus").search;

Try it yourself

Example 2

Change the URL query string of the specific area in the image map:

document.getElementById("venus").search = "somenewsearchvalue";

Try it yourself

Syntax

Return the search attribute:

areaObject.search

Set the search attribute:

areaObject.search = querystring

属性值

描述
querystring 规定 URL 的搜索部分。

技术细节

返回值: 字符串值,表示 URL 的查询字符串部分,包括问号 (?)。

浏览器支持

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
支持 支持 支持 支持 支持