案例:javascript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<body>
4
5
<p>点击下面的按钮,只要 i 小于 5 就一直循环代码块。</p>
6
<button onclick="myFunction()">点击这里</button>
7
<p id="demo"></p>
8
9
<script>
10
function myFunction()
11
{
12
var x="",i=0;
13
do
14
  {
15
  x=x + "The number is " + i + "<br>";
16
  i++;
17
  }
18
while (i<5)  
19
document.getElementById("demo").innerHTML=x;
20
}
21
</script>
22
23
</body>
24
</html>
25