You are on page 1of 3

Source Code:

<html>
<head>
<title>PANCARD VALIDATION</title>
<script language="javascript">
function alphanum()
{
var pno=frm.pan.value;
var patt=/^([A-Z]){5}([0-9]){4}([A-Z]){1}$/;
if(pno.length!=10)
{
alert("Pancard number should be of 10 characters");
}
else if(pno.match(patt))
{
alert("You have entered your Pancard number properly");
}
else
{
alert("Wrong Pancard number");
}
}
</script>
</head>
<body align="center" bgcolor="pink">
<center>
<h1>PANCARD VALIDATION USIGN JAVA
SCRIPT</h1>
<form name="frm">
<table>
<tr>
<td> Enter Name:</td>
<th><input type="text" name="name"></th>
</tr>
<tr>
<td>Enter Age:</td>
<th><input type="text" name="age"></th>
</tr>
<tr>
<td>Enter Pancard Number:</td>
<th><input type="text" name="pan" maxlength=10
placeholder="Like BBHPM5672K"></th>
</tr>
</table>
<input type="submit" name="submit" value="SUMBIT"
onclick="alphanum()">
</form>
</center>
</body>
</html>
OUTPUT:

You might also like