-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab2a.html
More file actions
34 lines (34 loc) · 875 Bytes
/
lab2a.html
File metadata and controls
34 lines (34 loc) · 875 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
<?xml version="1.0" encoding="UTF-80"?>
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/JavaScript">
function validateUsn(elem)
{
var alphaExp=/^[1-4][a-zA-Z][a-zA-Z][0-9][0-9][a-zA-Z][a-zA-Z][0-9][0-9][0-9]$/;
var str=elem.value;
if(!elem.value.match(alphaExp))
{
alert("Invalid usn");
return false;
}
else if(str.length!=10)
{
alert("Invalid usn");
return false;
}
else
{
alert("Valid USN");
return true;
}
}
</script>
</head>
<body>
<form>
<label>Enter the Usn:<input type="text" id="usn"/></label>
<input type="submit" onclick="validateUsn(document.getElementById('usn'))" value="Check Field"/>
</form>
</body>
</html>