aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/htmlanchorelement/search/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/api/htmlanchorelement/search/index.html')
-rw-r--r--files/zh-cn/web/api/htmlanchorelement/search/index.html117
1 files changed, 117 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmlanchorelement/search/index.html b/files/zh-cn/web/api/htmlanchorelement/search/index.html
new file mode 100644
index 0000000000..1fc142cc1f
--- /dev/null
+++ b/files/zh-cn/web/api/htmlanchorelement/search/index.html
@@ -0,0 +1,117 @@
+---
+title: HTMLHyperlinkElementUtils.search
+slug: Web/API/HTMLHyperlinkElementUtils/search
+tags:
+ - HTMLHyperlinkElementUtils.search
+translation_of: Web/API/HTMLHyperlinkElementUtils/search
+original_slug: Web/API/URLUtils/search
+---
+<p>{{ApiRef("URL API")}}</p>
+
+<p><strong><code>HTMLHyperlinkElementUtils.search</code></strong> 属性是一个搜索字符串,也叫做查询字符串, 它是一个 {{domxref("USVString")}} ,包含 <code>'?'</code> 和随后的 URL 参数。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox"><em>string</em> = <em>object</em>.search;
+<em>object</em>.search = <em>string</em>;
+</pre>
+
+<h2 id="示例">示例</h2>
+
+<pre class="brush: js">// 让一个
+// &lt;a id="myAnchor" href="https://developer.mozilla.org/en-US/docs/HTMLHyperlinkElementUtils.search?q=123" /&gt;
+// 元素在文档里
+
+let anchor = document.getElementById("myAnchor");
+let result = anchor.search;
+// 返回:'?q=123'
+</pre>
+
+<p> </p>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML WHATWG', '#dom-hyperlink-search', 'HTMLHyperlinkElementUtils.search')}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td>初始定义</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>基本支持</td>
+ <td>{{CompatVersionUnknown}} [1]</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("22")}} [3][4]</td>
+ <td>{{CompatVersionUnknown}} [2]</td>
+ <td>{{CompatVersionUnknown}} [2]</td>
+ <td>{{CompatVersionUnknown}} [2]</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android Webview</th>
+ <th>Chrome for Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>基本支持</td>
+ <td>{{CompatVersionUnknown}} [1]</td>
+ <td>{{CompatVersionUnknown}} [1]</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile("22")}} [3][4]</td>
+ <td>{{CompatVersionUnknown}} [2]</td>
+ <td>{{CompatVersionUnknown}} [2]</td>
+ <td>{{CompatVersionUnknown}} [2]</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] 自Chrome 52起,该属性移至{{domxref('URL')}}</p>
+
+<p>[2] 虽然没有被分在一个独立的抽象接口,但该方法可以在实现了它的那些接口上直接使用,如果支持该接口。</p>
+
+<p>[3] 从Gecko 22 到 Gecko 44,该属性在 <code>URLUtils</code> mixin 上。它已经被移到 <code>HTMLHyperlinkElementUtils</code> mixin,或者直接在这个接口上。</p>
+
+<p>[4] 在 Firefox 53之前, <code>pathname</code> 和<code> search</code> <code>HTMLHyperLinkElementUtils</code> 属性返回的URL部分是错误的。例如,对一个值为 <code>http://z.com/x?a=true&amp;b=false</code> 的URL,<code>pathname</code> 会返回"<code>/x?a=true&amp;b=false"</code> <code>,search</code> 会返回 "", 而不是各自返回 "<code>/x</code>" 和"<code>?a=true&amp;b=false"</code> 。这已经被修正了。</p>
+
+<h2 id="相关链接">相关链接</h2>
+
+<ul>
+ <li>它属于{{domxref("HTMLHyperlinkElementUtils")}} mixin 。</li>
+</ul>