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

来自 , 2021-04-27, 写在 JavaScript, 查看 174 次.
URL http://www.code666.cn/view/8c514936
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <p>Click the button to loop through a block of as long as <em>i</em> is less than 5.</p>
  6. <button onclick="myFunction()">Try it</button>
  7. <p id="demo"></p>
  8.  
  9. <script>
  10. function myFunction()
  11. {
  12. var x="",i=0;
  13. do
  14.   {
  15.   x=x + "The number is " + i + "<br>";
  16.   i++;
  17.   }
  18. while (i<5)  
  19. document.getElementById("demo").innerHTML=x;
  20. }
  21. </script>
  22.  
  23. </body>
  24. </html>
  25.  
  26.  
  27. //javascript/7838

回复 "JavaScript中do while循环语句的使用代码演示"

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

captcha