-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
67 lines (57 loc) · 1.85 KB
/
index.html
File metadata and controls
67 lines (57 loc) · 1.85 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
63
64
65
66
67
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600&display=swap');
body{
font-family: "Outfit",serif;
}
.text101{
text-align: center;
font-size: 20px;
font-weight: bold;
}
.text101{
border: 2px solid black;
height: 180px;
}
</style>
</head>
<body class="text101">
<label for="name">Name:</label>
<input type="text" id="name" name="name" placeholder="Enter your name" >
<br><br>
<label for="email" >Email:</label>
<input type="email" id="email" name="email" placeholder="Enter your mail" >
<br><br>
<label for="password" >Password:</label>
<input type="password" id="password" name="passowrd" placeholder="Enter your password" >
<br><br>
<button type="submit " onclick="checker()">Submit</button>
</body>
<script>
function checker(){
let name=document.getElementById("name").value;
let email=document.getElementById("email").value;
let password=document.getElementById("password").value;
if(name=="" || email=="" || password==""){
alert("Please fill all the fields");
}
else if(name.length<6){
alert("Name should not be lesser than 6 characters");
}
else if(password.length<6){
alert("Password length should be greater than 6 characters");
}
else if(!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(email)){
alert("Invalid email format");
}
else{
alert("Form submitted successfully");
}
}
</script>
</html>