aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/urlsearchparams/values
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/urlsearchparams/values
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/urlsearchparams/values')
-rw-r--r--files/zh-cn/web/api/urlsearchparams/values/index.html57
1 files changed, 57 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/urlsearchparams/values/index.html b/files/zh-cn/web/api/urlsearchparams/values/index.html
new file mode 100644
index 0000000000..a9e476bc83
--- /dev/null
+++ b/files/zh-cn/web/api/urlsearchparams/values/index.html
@@ -0,0 +1,57 @@
+---
+title: URLSearchParams.values()
+slug: Web/API/URLSearchParams/values
+tags:
+ - API
+ - Experimental
+ - Iterator
+ - Method
+ - Reference
+ - URL API
+ - URLSearchParams
+translation_of: Web/API/URLSearchParams/values
+---
+<p>{{APIRef("URL API")}}</p>
+
+<p>URLSearchParams.values()方法返回一个{{jsxref("Iteration_protocols",'iterator')}},该遍历器允许遍历对象中包含的所有值。这些值都是{{domxref("USVString")}}对象。</p>
+
+<div class="note">
+<p><strong>注意</strong>: 该方法在<a href="/en-US/docs/Web/API/Web_Workers_API">Web Workers</a>中也可使用</p>
+</div>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">searchParams.values();</pre>
+
+<h3 id="返回值">返回值</h3>
+
+<p>返回一个{{jsxref("Iteration_protocols","iterator")}}.</p>
+
+<h2 id="例子">例子</h2>
+
+<pre class="brush: js;highlight:[5]">// 创建一个测试用URLSearchParams对象
+var searchParams = new URLSearchParams("key1=value1&amp;key2=value2");
+
+// 输出值
+for(var value of searchParams.values()) {
+ console.log(value);
+}</pre>
+
+<p>结果如下:</p>
+
+<pre>value1
+value2</pre>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div>
+
+
+<p>{{Compat("api.URLSearchParams.values")}}</p>
+</div>
+
+<h2 id="另请参考">另请参考</h2>
+
+<ul>
+ <li>其他URL相关接口: {{domxref("URL")}}, {{domxref("URLUtils")}}.</li>
+</ul>