Web Technologies
Slip11
Q.1) 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 ) [Marks 30]
Solution
customer.html
<html><head>
<script>
function validate()
{
p=document.getElementById("pan").value;
if(!p.match(/^([\w]{5})(\d{4})([\w]{1}$)/))
alert("Invalid");
else
alert("valid");
}
</script>
</head>
<body>
name of customer:<input type="text" id=cname><br><br>
name of bank:<input type="text" id=bname><br><br>
account no:<input type="text" id=accno><br><br>
pan no:<input type="text" id=pan><br><br>
<input type="button" value=Submit id=sumbit onclick="validate()">
</body>
</html>
Tags:
Web Technologies