-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
33 lines (33 loc) · 917 Bytes
/
test.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
</head>
<body>
<input type="number" id="in">
<button id="btn">点击</button>
</body>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
$('#btn').on('click', function () {
var n = Number($('#in').val());
console.log(n);
switch (true) {
case n <= 0:
console.log('结果小于等于0');
break;
case n > 0 && n < 5:
console.log('结果大于0小于5');
break;
case n >= 5 && n < 10:
console.log('结果大于等于5');
break;
default:
console.log('都不是');
break;
}
});
</script>
</html>