Javascript-do_while....

 1 <!DOCTYPE html>
 2 <html>
 3 <head lang="en">
 4     <meta charset="UTF-8">
 5     <title></title>
 6 </head>
 7 <body>
 8  <script>
 9      function printMsg(){
10          //让用户录入数据,如果是exit,则退出程序,否则打印输出,继续录入
11          do{
12              //用户输入
13              var input=prompt("请输入一个数据");
14              if(input=="exit"){
15                  console.log("程序结束")
16              }else{
17                  console.log(input);
18              }
19          }while(input!="exit")
20      }
21  </script>
22 <button onclick="printMsg()">猜猜猜</button>
23 </body>
24 </html>
原文地址:https://www.cnblogs.com/longly/p/6136527.html