aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/statements/do...while
diff options
context:
space:
mode:
authorIrvin <irvinfly@gmail.com>2022-02-16 02:07:31 +0800
committerIrvin <irvinfly@gmail.com>2022-02-16 02:35:54 +0800
commitd9e9adb5f80a819fe46349bcf6d1faec734b09cd (patch)
treee856dc5e31aad0a7d5e8c2f98c9ee139d9569a86 /files/zh-cn/web/javascript/reference/statements/do...while
parent7c2556fe79c44d7c31108b8c8b048d2b7704a95e (diff)
downloadtranslated-content-d9e9adb5f80a819fe46349bcf6d1faec734b09cd.tar.gz
translated-content-d9e9adb5f80a819fe46349bcf6d1faec734b09cd.tar.bz2
translated-content-d9e9adb5f80a819fe46349bcf6d1faec734b09cd.zip
remove span tag in zh-CN
Diffstat (limited to 'files/zh-cn/web/javascript/reference/statements/do...while')
-rw-r--r--files/zh-cn/web/javascript/reference/statements/do...while/index.html22
1 files changed, 11 insertions, 11 deletions
diff --git a/files/zh-cn/web/javascript/reference/statements/do...while/index.html b/files/zh-cn/web/javascript/reference/statements/do...while/index.html
index bd3fb46473..714c0e807e 100644
--- a/files/zh-cn/web/javascript/reference/statements/do...while/index.html
+++ b/files/zh-cn/web/javascript/reference/statements/do...while/index.html
@@ -10,7 +10,7 @@ translation_of: Web/JavaScript/Reference/Statements/do...while
<div>{{jsSidebar("Statements")}}</div>
</div>
-<p><strong><code>do...while</code> 语句</strong><span lang="zh-CN"><span>创建一个执行指定语句的循环,直到</span></span><code>condition</code><span lang="zh-CN"><span>值为 false。</span><span>在执行</span></span><code>statement</code> <span lang="zh-CN"><span>后检测</span></span><code>condition</code><span lang="zh-CN"><span>,所以指定的</span></span><code>statement</code><span lang="zh-CN"><span>至少执行一次。</span></span></p>
+<p><strong><code>do...while</code> 语句</strong>创建一个执行指定语句的循环,直到<code>condition</code>值为 false。在执行<code>statement</code> 后检测<code>condition</code>,所以指定的<code>statement</code>至少执行一次。</p>
<h2 id="Syntax" name="Syntax">语法</h2>
@@ -21,12 +21,12 @@ while (<em>condition</em>);
<dl>
<dt><code>statement</code></dt>
- <dd><span class="short_text" id="result_box" lang="zh-CN"><span>执行至少一次的语句,并在每次 </span></span><code>condition</code> <span class="short_text" lang="zh-CN"><span>值为真时重新执行。</span></span>想执行多行语句,可使用<span style="line-height: 19.0909080505371px;">{{jsxref("Statements/block", "block")}}</span>语句<span style="line-height: 19.0909080505371px;">(</span><code style="font-style: normal; line-height: 19.0909080505371px;">{ ... }</code><span style="line-height: 19.0909080505371px;">)</span>包裹这些语句。</dd>
+ <dd>执行至少一次的语句,并在每次 <code>condition</code> 值为真时重新执行。想执行多行语句,可使用{{jsxref("Statements/block", "block")}}语句(<code style="font-style: normal; line-height: 19.0909080505371px;">{ ... }</code>)包裹这些语句。</dd>
</dl>
<dl>
<dt><code>condition</code></dt>
- <dd>循环中每次都会计算的表达式。如果 <code>condition</code> 值为真, <code>statement</code> 会再次执行。当 <code>condition</code> <span style="line-height: 19.0909080505371px;">值为假</span>,则跳到<code>do...while</code>之后的语句。</dd>
+ <dd>循环中每次都会计算的表达式。如果 <code>condition</code> 值为真, <code>statement</code> 会再次执行。当 <code>condition</code> 值为假,则跳到<code>do...while</code>之后的语句。</dd>
</dl>
<h2 id="Examples" name="Examples">示例</h2>
@@ -37,17 +37,17 @@ while (<em>condition</em>);
<h3 id="HTML_内容">HTML 内容</h3>
-<pre class="brush: html line-numbers language-html"><code class="language-html"><span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>div</span> <span class="attr-name token">id</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>example<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span><span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>div</span><span class="punctuation token">&gt;</span></span></code></pre>
+<pre class="brush: html line-numbers language-html"><code class="language-html">&lt;div id="example"&gt;&lt;/div&gt;</code></pre>
<h3 id="JavaScript_内容">JavaScript 内容</h3>
-<pre class="brush: js"><code class="language-js"><span class="keyword token">var</span> result <span class="operator token">=</span> <span class="string token">''</span><span class="punctuation token">;</span>
-<span class="keyword token">var</span> i <span class="operator token">=</span> <span class="number token">0</span><span class="punctuation token">;</span>
-<span class="keyword token">do</span> <span class="punctuation token">{</span>
- i <span class="operator token">+</span><span class="operator token">=</span> <span class="number token">1</span><span class="punctuation token">;</span>
- result <span class="operator token">+</span><span class="operator token">=</span> i <span class="operator token">+</span> <span class="string token">' '</span><span class="punctuation token">;</span>
-<span class="punctuation token">}</span> <span class="keyword token">while</span> <span class="punctuation token">(</span>i <span class="operator token">&lt;</span> <span class="number token">5</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
-document<span class="punctuation token">.</span><span class="function token">getElementById</span><span class="punctuation token">(</span><span class="string token">'example'</span><span class="punctuation token">)</span><span class="punctuation token">.</span>innerHTML <span class="operator token">=</span> result<span class="punctuation token">;</span></code></pre>
+<pre class="brush: js"><code class="language-js">var result = '';
+var i = 0;
+do {
+ i += 1;
+ result += i + ' ';
+} while (i &lt; 5);
+document.getElementById('example').innerHTML = result;</code></pre>
<h3 id="结果">结果</h3>