0%

js加减法

js加减法

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
<html>
<head>
<meta http-equiv="content-type" content='text/html;charset="utf-8"'>
<script>
function getRandom() {//孤风傲雪逗自己玩
var rnd = Math.random();
var number = Math.floor(rnd * 10);
return number;
}

var a = getRandom();
var b = getRandom();
var aaa = a;
var bbb = b;
var aa = String(a);
var bb = String(b);
if (getRandom() % 2 == 0) {
var c = a + b;
var password = prompt(aa + "+" + bb + "=" + "?", "");
if (password == c) {

alert("正确");
} else {
alert("错误");
}
} else {
var c = a - b;
var password = prompt(aa + "-" + bb + "=" + "?", "");
if (password == c) {

alert("正确");
} else {
alert("错误");
}


}
</script>

</head>
<body>
</body>
</html>

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!