Back to Scripts page
Click in the box below, select all and copy to grab the script
<SCRIPT LANGUAGE="JavaScript"> <!-- Hide script from older browsers // This script copyright 1997, Tom Negrino and Dori Smith. // This script is from "JavaScript for the WWW, Visual QuickStart Guide, 2nd Ed." // This script may be used and modified, but the copyright notice must remain intact. function isNum(passedVal) { // Is this a number? if (passedVal == "") { return false } for (i=0; i<passedVal.length; i++) { if (passedVal.charAt(i) < "0") { return false } if (passedVal.charAt(i) > "9") { return false } } return true } function validZip(inZip) { // Is this a valid Zip code? if (inZip == "") { return true } if (isNum(inZip)) { // Check if Zip is numeric return true } return false } function submitIt(form) { if (!validZip(form.zip.value)) { alert("That is an invalid Zip code") form.zip.focus() form.zip.select() return false } return true } // End hiding script --> </SCRIPT>