标签:
}
<!DOCTYPE html>
<html>
<body>
<meta http-equiv="Content-Type" content="text/html charset=utf-8"/>
<p>点击下面的按钮,只要 i 小于 5 就一直循环代码块。</p>
<button onclick="myFunction()">点击这里</button>
<p id="demo"></p>
<script>
function myFunction()
{
var x="",i=0;
while (i<5)
{
x=x+"The number is " + i +"<br>";//将每一次执行的结果输出
//document.write(x);
document.getElementById("demo").innerHTML=x;
i++;
}
//document.getElementById("demo").innerHTML=x;
}
</script>
</body>
</html>
标签:
原文地址:http://blog.csdn.net/u012701023/article/details/46313175