-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path作业2.html
63 lines (57 loc) · 1.74 KB
/
作业2.html
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
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<a id="yuan">我是帅比</a>
<script>
var a = prompt("第一个数");
var b = prompt("第二个数");
a=toString(a)&&Number(a);
if(isNaN(a)){
alert("你的输入不满足要求!");
}
b=toString(b)&&Number(b);
if(isNaN(b)){
alert("你的输入不满足要求!");
}
alert("和"+(Number(a)+Number(b))+"差"+(a-b)+"积"+(a*b)+"商"+(a/b));
var num = prompt("输入一个数字");
num=toString(num)&&Number(num);
if(isNaN(num)){
alert("你的输入不满足要求!");
}
else if(num%2!=0){
alert("你输入的"+Number(num)+"是奇数");
}
else{
alert("你输入的"+Number(num)+"是偶数");
}
var chinese = prompt("语文几分");
var math = prompt("数学几分");
var english = prompt("英语几分");
var aver = (Number(chinese)+Number(math)+Number(english))/3;
alert("平均分="+aver);
switch(true){
case 0<aver<50:
alert("差");
break;
case 50<=aver<100:
alert("普通");
break;
case aver>=100:
alert("好");
break;
default:
alert("未知");
break;
}
var r = prompt("圆的半径");
var i =document.getElementById("yuan");
i.innerText=("面积="+(3.14*r*r)+"周长="+(2*3.14*r));
</script>
</body>
</html>