简单教程
提交运行
代码编辑器:
<p>点击按钮循环代码块 5 次</p> <button onclick="myFunction()">点我</button> <p id="demo"></p> <script> function myFunction() { var text = ""; var i; for (i = 0; i < 5; i++) { text += "The number is " + i + "<br>"; } document.getElementById("demo").innerHTML = text; } </script>
运行结果: