switch...ease语句嵌套if等循环语句

    xiaoxiao2022-07-07  203

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>if循环与switch case嵌套</title> </head> <body> </body> <script> var a = window.prompt("请输入数字"); b = 0; var i =parseInt(a); switch(i){ case 10: if(b>1){ document.write("aaaa"); } else{ document.write("bbbb"); } break; case 11: document.write("<pre>") do{ document.write(b + "\n"); b++ ; }while(b <= 99) document.write("</pre>") break; case 12: document.write("<pre>") for(var c=0;c<=99;c++) { document.writeln(b); b++; } document.write("</pre>") break; default: document.write("开挂了你"); break; } </script> </html>

    …还是挺拗口的一个东西。

    最新回复(0)