<html>
<body>
<p>点击按钮,在 i 小于 5 的条件下循环代码。</p>
<button onclick="myFunction()">点我</button>
<p id="demo"></p>
<script>
function myFunction() {
var text = ""
var i = 0;
do {
text += "<br>The number is " + i;
i++;
}
while (i < 5)
document.getElementById("demo").innerHTML = text;
}
</script>
</body>
</html>