-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
62 lines (53 loc) · 1.84 KB
/
Copy pathtest.js
File metadata and controls
62 lines (53 loc) · 1.84 KB
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
window.onload = ()=>{
this.sessionStorage.setItem('name', '박수근');
this.sessionStorage.setItem('password', '1906');
}
var input = document.getElementsByTagName('input');
var login = document.getElementById('log-in');
var form = document.querySelector('form');
form.onsubmit = ()=>{return false;}
login.onclick = ()=>{
if ((input[0].value != "") && (input[1].value != ""))
{
if ((input[0].value == sessionStorage.getItem('name')) && (input[1].value == sessionStorage.getItem('password')))
{
form.onsubmit = ()=>{return 1;}
document.cookie = "name="+input[0].value;
document.cookie = "password="+input[1].value;
}
else
{
if ((input[0].value != sessionStorage.getItem('name')) )
{
input[0].nextElementSibling.textContent = "name NOT match";
setTimeout(()=>{
input[0].nextElementSibling.textContent = "";
}, 2000);
}
if ((input[1].value != sessionStorage.getItem('password')) )
{
input[1].nextElementSibling.textContent = "Password NOT match";
setTimeout(()=>{
input[1].nextElementSibling.textContent = "";
}, 2000);
}
}
}
else
{
if (input[0].value == "")
{
input[0].nextElementSibling.textContent = "name is empty";
setTimeout(()=>{
input[0].nextElementSibling.textContent = "";
}, 2000);
}
if (input[1].value == "")
{
input[1].nextElementSibling.textContent = "Password is empty";
setTimeout(()=>{
input[1].nextElementSibling.textContent = "";
}, 2000);
}
}
}