-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
144 lines (130 loc) · 4.22 KB
/
index.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="shortcut icon" href="image2.jpg" type="image/x-icon">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gaming Page</title>
</head>
<body>
<div class="wholeform">
<div class="form">
<h1>Gaming Form</h1>
<em> <p id="announce">*If you are you new user and want to register, kindly enter the details and submit 'register'</p></em>
<em><p id="announce">
The submit button will turn <span class="red">red</span> and disabled when details are wrong.
</p></em>
<label for="">Username</label>
<input type="text" id="username" placeholder="Enter Username">
<label for="">Password</label>
<input type="password" id="pass" placeholder="Enter Password">
</div>
<button onclick="validate()" id="subBtn">Submit Form</button>
<button id="newcustomer"><a href = 'register.html'>New customer?</a></button>
</div>
<style>
*{
font-family: Arial, Helvetica, sans-serif;
}
#newcustomer a{
text-decoration: none;
color: white;
}
#newcustomer{
font-size: 20px;
background-color: lightblue;
color: black;
}
#announce{
text-align: center;
}
.red{
color: red;
text-decoration: underline;
}
h1{
text-decoration: underline overline;
font-size: 40px;
color: white;
}
.wholeform{
margin-left: 510px;
background-image: linear-gradient(45deg,#56ab2f, #a8e063);
width: 500px;
/* height: 500px; */
padding: 20px;
border-radius: 20px;
box-shadow: 10px 10px 10px grey;
}
body{
background-image: url('remation.jpg');
}
.form{
/* border: 1px solid black; */
width: 500px;
text-align: center;
}
label{
font-size: 40px;
}
input{
font-size: 40px;
}
button{
margin-top:20px;
font-size: 30px;
padding: 10px;
background-color: lightcoral;
color: white;
transition: ease-in-out .3s;
border: none;
box-shadow: 10px 5px 5px black;
margin-left: 50px;
}
button:hover{
/* transform: scaleX(2); */
transform: scaleY(1.5);
letter-spacing: 2px;
border-radius: 10px;
}
button:active{
box-shadow: 0px 0px 0px white;
}
</style>
<script>
function validate(){
let users =[['dev','devpatel'],['chase','woofwoof']];
const usernameInput = document.getElementById('username').value;
const passwordInput = document.getElementById('pass').value;
const subBtn = document.getElementById('subBtn');
let matchFound = false;
for(let i = 0; i<users.length; i++){
const user = users[i];
if(user[0] === usernameInput && user[1] === passwordInput){
matchFound = true;
break;
}
}
if(matchFound){
alert('Details Matched! Succesfully Matched')
}else if(usernameInput.trim() === '' || passwordInput.trim() === ''){
alert('One or more fields are blank')
}
else{
alert("Details don't match!")
document.getElementById('subBtn').disabled = true;
subBtn.style.backgroundColor = 'red';
}
}
function register(){
let users =[['dev','devpatel'],['chase','woofwoof']];
const usernameInput = document.getElementById('username').value;
const passwordInput = document.getElementById('pass').value;
const newData = [usernameInput , passwordInput];
newData.push(newData);
alert(users)
}
</script>
</body>
</html>