-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecimal_check.html
More file actions
36 lines (32 loc) · 873 Bytes
/
decimal_check.html
File metadata and controls
36 lines (32 loc) · 873 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>form validation</title>
</head>
<body onload="document.form1.text1.focus()">
<h2>Enter your name and press submit</h2>
<form name="form1" action="#">
<input type="text" name="text1">
<input type="submit" name="submit" value="Submit" onclick="allLetter(document.form1.text1)"/>
</form>
<script>
function allLetter(inputtxt) {
letters = /^[0-9]+(\.[0-9]+)+$/;
//letters = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
// letters = /^[A-Za-z]+$/;
if (inputtxt.value.match(letters))
{
alert("ur email is valid ");
return true;
}
else
{
alert("please enter valid email");
document.form1.text1.focus();
return false;
}
}
</script>
</body>
</html>