<%@LANGUAGE="JavaScript"%> <% //No ASP Here, just a regular HTML Page %> <HTML> <SCRIPT LANGUAGE="JavaScript"> <!--Hide function checkMyZip(zipCode) { var myRegularExpression=/(^/d{5}$)|(^/d{5}-/d{4}$)/ if (myRegularExpression.test(zipCode) == true) { return nothingIsWrong(); } else { return somethingIsWrong(); } }
function nothingIsWrong() { //Do nothing return true }
function somethingIsWrong() { alert("Something is wrong with the zip code you provided.") document.zipCodeForm.zipCodeText.focus() return false; } //Stop Hiding--> </SCRIPT> <STRONG>Type a valid U.S. Postal zip code into the box, and submit it.</STRONG> <FORM NAME="zipCodeForm" ACTION="script05a.asp" METHOD="Post" onSubmit="return checkMyZip(document.zipCodeForm.zipCodeText.value)"> <INPUT TYPE="Text" NAME="zipCodeText"><BR> <BR> <INPUT TYPE="Submit" VALUE="Submit"> </FORM> </HTML>