-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsign.html
executable file
·70 lines (60 loc) · 1.71 KB
/
sign.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
66
67
68
69
70
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
div{
background: rgb(237, 235, 235);
transition: 0.5s;
margin: 200px auto;
text-align: center;
padding: 20px;
width: 300px;
height: 25px;
box-shadow: 0px 0px 20px grey;
border-radius: 10px;
}
#sp{
transition: 0.5s;
margin: 10px auto;
display: none;
width: 200px;
height: 25px;
background: rgb(232, 238, 238);
}
</style>
</head>
<body>
<div id='box'>
用户名:<input type='text' id='ipt'>
<span id='sp'></span>
</div>
<script>
oipt = document.getElementById('ipt');
osp = document.getElementById('sp');
obox = document.getElementById('box');
oipt.onblur = function () {
osp.style.display = 'block';
obox.style.height = '50px';
var xhr = 'null';
try {
xhr = new XMLHttpRequest;
} catch {
xhr = new ActiveXObject('Microsoft.XMLHTTP');
}
xhr.open('get', '/sign-ck?username=' + oipt.value, true);
xhr.send();
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
var res_json = JSON.parse(xhr.responseText);
osp.innerHTML = '"' + oipt.value + '"' + res_json.msg;
}
}
}
oipt.onfocus = function () {
osp.style.display = 'none';
obox.style.height = '25px';
}
</script>
</body>
</html>