-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtable w22.html
56 lines (48 loc) · 1.62 KB
/
table w22.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div align = "center">
<table border="1">
<tr>
<th>name</th>
<th><input type="text" id ="name"placeholder="enter your name"></th>
</tr>
<tr>
<th>Email</th>
<th><input type="text" id="email" placeholder="enter your Email"></th>
</tr>
<tr>
<th>Pincode</th>
<th><input type="number" id="pin" placeholder="enter your name"></th>
</tr>
<tr>
<th></th>
<th><input type="button" value="Submit" onclick="submit()"></th>
</tr>
</table>
</div>
<script>
function submit() {
var name = document.getElementById("name").value;
var email = document.getElementById("email").value;
var pin = document.getElementById("pin").value;
if (name === "" || email === "" || pin === "") {
alert("Enter some value; don't leave it blank.");
return;
}
var rege = /^\d{6}/;
if (!rege.test(pin)) {
alert("Pin should be only 6 digits.");
return;
}
alert("Form submitted successfully.");
}
rege.reset()
</script>
</body>
</html>