-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.html
159 lines (153 loc) · 5.08 KB
/
signup.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
#form>input{
display: block;
/* margin-bottom:20px; */
padding:5px;
width:95%;
margin: auto;
margin-bottom:20px;
}
#box{
margin:auto;
width:27%;
/* border:1px solid; */
margin-top:50px;
}
#form{
margin:auto;
}
#header{
text-align: center;
/* position: absolute; */
top: 30px;
margin-top: 3px;
color:rgb(63, 61, 61);
}
img{
width:100%;
/* position: relative; */
margin-bottom: 0px;
}
#password+input{
margin: auto;
cursor: pointer;
}
#box{
font-family: cursive, sans-serif;
/* background-color: #2ecc71; */
/* color: white; */
padding: 8px;
border-radius: 2px;
box-shadow: 2px 2px 20px 23px #ffdefa;
}
#radio>label{
color:blue;
margin-left: 20px;
}
#radio>input+label{
color:rgb(246, 100, 124);
}
/* input:invalid{
animation: shake 300ms;
}
@keyframes shake {
25% { transform: translateX(4px); }
50% { transform: translateX(-4px); }
75% { transform: translateX(4px); }
} */
</style>
<!-- <link rel="stylesheet" href="common.css" /> -->
</head>
<body>
<div id="box">
<img src="https://assets.myntassets.com/f_webp,dpr_1.5,q_60,w_400,c_limit,fl_progressive/assets/images/2022/1/14/d63fc446-4087-4e07-b2dd-1d060368d2661642184399341-Banner_Login-page-400.png"/>
<h1 id="header">Sign up</h1>
<form id="form">
<label id="nam" style="color: black">Full Name</label>
<input type="text" placeholder="Enter your fullname" id="name"/>
<label id="ema">Email</label>
<input type="text" placeholder="Enter your Email" id="email"/>
<label id="pass">Password</label>
<input type="text" placeholder="Enter password" id="password"/>
<!-- <label for="input-1" class="radio">gender</label>
<input type="radio" id="input-1" name="gender" class="radio-input"/> -->
<label for="start">Enter D.O.B</label>
<input type="date" name="begin" placeholder="dd-mm-yyyy" value="" min="1990-01-01" max="2030-12-30" >
<div id="radio">
<label for="gender">Male</label>
<input type="radio" name="gender" value="male">
<label for="gender">Female</label>
<input type="radio" name="gender" value="female">
</div>
<input type="submit" value="sign up" class="sub"/>
</form>
</div>
</body>
</html>
<script>
document.querySelector("#form").addEventListener("submit",myfunction);
var arr=[];
function myfunction(){
event.preventDefault();
var obj={
name:form.name.value,
email:form.email.value,
password:form.password.value,
}
if(obj.name==""||obj.email==""||obj.password=="") {
var p=document.createElement("p");
p.innerText="please fill all the information which is mentioned above";
p.style.color="red";
p.style.fontSize="12px"
p.style.textAlign="center"
if(obj.name=="") {
document.querySelector("#nam").style.color="red";
}
else {
document.querySelector("#nam").style.color="black";
}
if(obj.email=="") {
document.querySelector("#ema").style.color="red";
}
else {
document.querySelector("#ema").style.color="black";
}
if(obj.password=="") {
document.querySelector("#pass").style.color="red";
}
else {
document.querySelector("#pass").style.color="black";
document.querySelector("#pass").innerHTML="password";
document.querySelector("#pass").style.fontSize="17px";
}
document.querySelector("#box").append(p);
}
else if(obj.password.length<6&&obj.password!="") {
console.log("kai");
document.querySelector("#pass").innerHTML="please fill at least 6 digits or character";
document.querySelector("#pass").style.fontSize="13px";
document.querySelector("#pass").style.color="red"
}
else {
arr.push(obj)
console.log(obj);
if(obj.password.length<6) {
console.log("kk");
}
localStorage.setItem("signp",JSON.stringify(arr))
alert("signup successful")
window.location.href="login.html"
}
if(obj.name=="") {
// document.querySelector("#nam").innerHTML.style.color="red";
console.log("red")
}
}
</script>