<html>
<head>
<title></title>
<script type="text/javascript">
<!--
function formatZip(objFormField){
intFieldLength = objFormField.value.length;
if(intFieldLength==2){
objFormField.value = objFormField.value + ",";
return false;
}
}
//-->
</script>
</head>
<body>
<form name="form1" method="post" action="">
<input type="text" name="zip" onKeyPress="formatZip(this
</form>
</body>
</html>
Main Topics
Browse All Topics





by: rdmjrbPosted on 2003-06-23 at 11:34:42ID: 8783618
Basically you would have a function that gets fired onKeyPress that firstly checks the user only types numbers and second checks the length and if the length is 3/6/9, etc then it sticks a ',' in the string.
m that may help your cause.
This is a pretty complicated piece of javascript for only 30 points, however this is one of the best javascript sites I have come across: http://www.dynamicdrive.co