aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/string/quote/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/string/quote/index.html')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/string/quote/index.html116
1 files changed, 116 insertions, 0 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/quote/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/quote/index.html
new file mode 100644
index 0000000000..3d8d197f46
--- /dev/null
+++ b/files/zh-cn/web/javascript/reference/global_objects/string/quote/index.html
@@ -0,0 +1,116 @@
+---
+title: String.prototype.quote()
+slug: Web/JavaScript/Reference/Global_Objects/String/quote
+tags:
+ - JavaScript
+ - Method
+ - Non-standard
+ - Obsolete
+ - Prototype
+ - String
+translation_of: Archive/Web/JavaScript/String.quote
+---
+<div>{{obsolete_header("37")}}</div>
+
+<div>{{JSRef("Global_Objects", "String")}}{{Non-standard_header}}</div>
+
+<h2 id="Summary" name="Summary">概述</h2>
+
+<p>将字符串中包含的特殊字符进行转义(反斜杠),然后在字符串两边各加上一个双引号(<code>"</code>)并返回,并不修改原字符串.</p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="syntaxbox"><code><em>str</em>.quote()</code></pre>
+
+<h2 id="Examples" name="Examples">示例</h2>
+
+<table class="fullwidth-table">
+ <thead>
+ <tr>
+ <th class="header" scope="col"><code>str</code></th>
+ <th class="header" scope="col"><code>str.quote()</code></th>
+ <th class="header" scope="col"><code><a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/eval" title="JavaScript/Reference/Global_Objects/eval">eval</a>(str.quote())</code></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>Hello world!</code></td>
+ <td><code>"Hello world!"</code></td>
+ <td><code>Hello world!</code></td>
+ </tr>
+ <tr>
+ <td><code>Hello<br>
+         world!</code></td>
+ <td><code>"Hello\n\tworld!"</code></td>
+ <td><code>Hello<br>
+         world!</code></td>
+ </tr>
+ <tr>
+ <td><code>" \ — '</code></td>
+ <td><code>"\" \\ \u2014 '"</code></td>
+ <td><code>" \ — '</code></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Specifications" name="Specifications">规范</h2>
+
+<p>不在任何规范中。实现于 JavaScript 1.3.</p>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also" name="See_also">相关链接</h2>
+
+<ul>
+ <li><code><a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/JSON/stringify" title="JavaScript/Reference/Global_Objects/JSON/stringify">JSON.stringify</a></code></li>
+</ul>