<html>
<head>
<script type="text/javascript">
function PinVerify()
{
var strtext=document.getElementById("textbox").value;
var index=strtext.length;
//document.write(index);
if(index==6)
{
///document.write("1111111");
if(strtext.charCodeAt(0)==48)
{
//document.write("222222");
alert("ZIP Cannot start from zero");
}
else
{
//document.write("222211111");
for(var i=1;i<index;i++)
{
//document.write("22222sdsdsd2");
var asciiValue=strtext.charCodeAt(i);
if(asciiValue>=48&&asciiValue<=57)
{
//document.write("22222256565656");
alert("Pin is Correct ");
}
else
{
alert("Only Numbers is allowed in Zip Code");
}
}
}
}
else
{
alert("Pin code length can not be less than six");
}
}
</script>
</head>
<body>
Enter any value:<input type="text" id="textbox" />
<button onClick="PinVerify()">Check For Zip Code</button>
</body>
</html>