diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/url/search/index.html | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/url/search/index.html')
-rw-r--r-- | files/zh-cn/web/api/url/search/index.html | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/url/search/index.html b/files/zh-cn/web/api/url/search/index.html new file mode 100644 index 0000000000..7bbe118ad5 --- /dev/null +++ b/files/zh-cn/web/api/url/search/index.html @@ -0,0 +1,63 @@ +--- +title: URL.search +slug: Web/API/URL/search +tags: + - API + - Property + - Reference + - Search + - URL +translation_of: Web/API/URL/search +--- +<div>{{ApiRef("URL API")}}</div> + +<p>{{domxref("URL")}} 接口的<strong><code>search</code></strong> 属性是一个搜索字符串, 也称为查询字符串,这是一个{{domxref("USVString")}}包含一个 <code>'?'</code>后面跟着URL的参数</p> + +<p>现代浏览器提供{{domxref("URL.searchParams")}}属性,以便轻松解析查询字符串中的参数。</p> + +<p>{{AvailableInWorkers}}</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox"><em>string</em> = <em>object</em>.search; +<em>object</em>.search = <em>string</em>; +</pre> + +<h3 id="值">值</h3> + +<p>一个 {{domxref("USVString")}}.</p> + +<h2 id="例子">例子</h2> + +<pre class="brush: js">var url = new URL('https://developer.mozilla.org/en-US/docs/Web/API/URL/search?q=123'); +var queryString = url.search; // Returns:"?q=123" +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">规范</th> + <th scope="col">状态</th> + <th scope="col">说明</th> + </tr> + <tr> + <td>{{SpecName('URL', '#dom-url-search', 'URL.search')}}</td> + <td>{{Spec2('URL')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<div class="hidden">该页面上的兼容性表是由结构化数据生成的。如果您想对数据做出贡献,请查看https://github.com/mdn/browser-compat-data,并向我们发送一个pull request。</div> + +<p>{{Compat("api.URL.search")}}</p> + +<h2 id="参考">参考</h2> + +<ul> + <li>它所属的{{domxref("URL")}}接口。</li> +</ul> |