[JavaScript] JavaScript中for循环使用代码演示 →→→→→进入此内容的聊天室

来自 , 2020-02-03, 写在 JavaScript, 查看 156 次.
URL http://www.code666.cn/view/9f16b57b
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <p>sharejs.com,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>
  23.  
  24. //javascript/7835

回复 "JavaScript中for循环使用代码演示"

这儿你可以回复上面这条便签

captcha