Thursday, 22 August 2019

WT-Slip11


11. Write a Java Script program to design Customer Account Details Form and perform validation on pan number field. (pan number is of only 10 characters long, out of which first 5  characters are alphabets, next 4  characters are digits and last character is alphabet )


<html>
<head>
<script type="text/javascript">
function ValidatePAN()
{
var pan_no = document.getElementById("pan");
    
if (pan_no.value != "")
{
PanNo = pan_no.value;
var panPattern = /^([a-zA-Z]{5})(\d{4})([a-zA-Z]{1})$/;
if (PanNo.search(panPattern) == -1)
{
alert("Invalid Pan No");
// pan_no.focus();
// pan_no.value='';
return false;
 }
else
{
alert("valid Pan No")
}
      
 }
}

</script>
</head>
<body>

<input  type="text" name="organisation_pan" id="pan" class="inputbox">
<input type="submit" value="submit" onclick="ValidatePAN(this)">
</body>
</html>