forked from linkours/60s-countdown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path60sDown.html
65 lines (65 loc) · 1.35 KB
/
60sDown.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
64
65
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
div{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
div a,#times{
display: inline-block;
color: #555;
font-size: 18px;
line-height: 50px;
text-align: center;
border: 1px solid #bbb;
cursor: pointer;
}
div a{
width: 100px;
height: 48px;
text-decoration: none;
margin-right: 15px;
}
div a:hover{
color: darkgoldenrod;
border-color: darkgoldenrod;
}
#times{
width: 150px;
height: 50px;
outline: none;
background: none;
}
#times:hover{
color: crimson;
border-color: crimson;
}
</style>
</head>
<body>
<div>
<a href="https://github.com/linkours/60s-countdown">返回</a>
<input type="button" name="times" id="times" value="获取验证码" onclick="clickBtn()"/>
</div>
<script>
function clickBtn(){
var count=60;
var times=setInterval(function () {
if (count > 0) {
count--;
document.getElementById("times").value=count+" s";
} else {
count = 60;
document.getElementById("times").value="获取验证码";
clearInterval(times);
}
}, 1000);
}
</script>
</body>
</html>