实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<body>
4
5
<p>Click the button to loop through a block of code five times.</p>
6
<button onclick="myFunction()">Try it</button>
7
<p id="demo"></p>
8
9
<script>
10
function myFunction()
11
{
12
var x="",i;
13
for (i=0;i<5;i++)
14
  {
15
  x=x + "The number is " + i + "<br>";
16
  }
17
document.getElementById("demo").innerHTML=x;
18
}
19
</script>
20
21
</body>
22
</html>