1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>输出1-100之间能被3整除的数</title> 6 </head> 7 <body> 8 <script type="text/javascript"> 9 var i=1; 10 while (i<=100) { 11 if(i % 3 ==0){ 12 document.write(i+"<br/>"); 13 } 14 i++; 15 } 16 </script> 17 </body> 18 </html>
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 </head> 7 <body> 8 <script type="text/javascript"> 9 var score = window.prompt(); 10 if( score == null) 11 { 12 result = "取消!"; 13 }else if( score == "" ) 14 { 15 result = "你什么也没有输入!"; 16 }else if( parseFloat(score) != score ) 17 { 18 result = "你输入的不是一个数!"; 19 }else if(score>100 || score<0) 20 { 21 result = "超出范围"; 22 }else 23 { 24 if( score >=90 && score<=100) 25 { 26 result = "优秀"; 27 }else if(score>=80) 28 { 29 result = "良好"; 30 }else if(score>=70) 31 { 32 result = "中等"; 33 }else if(score>=60) 34 { 35 result = "及格"; 36 }else 37 { 38 result = "不及格"; 39 } 40 } 41 document.write(result); 42 </script> 43 </body> 44 </html>