1、源码
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>JavaScript</title> <script type="text/javascript"> var score = prompt("请输入一个分数",""); if(!score){ alert("您没有输入值!"); }else{ score *= 1; if(isNaN(score)) { alert("您输入不合法的值!"); }else{ if(score >= 0 && score < 60) { alert("E"); }else{ if(score >= 60 && score < 70) { alert("D"); }else{ if(score >= 70 && score < 80) { alert("C"); }else{ if(score >= 80 && score < 90) { alert("B"); }else{ if(score >= 90 && score <= 100) { alert("A"); } } } } } } } </script> </head> <body> </body> </html>
最后
以上就是坦率音响最近收集整理的关于JavaScript中的if...else if...语句的全部内容,更多相关JavaScript中的if...else内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复