<%@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>
<%@LANGUAGE="JavaScript"%> <% 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() { return false; }
var zipCode=new String(Request.Form("zipCodeText"))
if (checkMyZip(zipCode)==true) { Response.Write("<HTML>/r") Response.Write("The zip code you provided... ") Response.Write("<FONT COLOR=/"RED/">") Response.Write(zipCode + "</FONT> is good./r") Response.Write("</HTML>/r") } else { Response.Write("<HTML>/r") Response.Write("The zip code you provided... ") Response.Write("<FONT COLOR=/"RED/">") Response.Write(zipCode + "</FONT> has a problem./r") Response.Write("</HTML>/r") }
<%@LANGUAGE="JavaScript"%> <% //No ASP Here, just a regular HTML Page %> <HTML> <STRONG>Type a zip code (with no client side validation) into the box submit it.</STRONG> <FORM NAME="zipCodeForm" ACTION="script05a.asp" METHOD="Post"> <INPUT TYPE="Text" NAME="zipCodeText"><BR> <BR> <INPUT TYPE="Submit" VALUE="Submit"> </FORM> </HTML>