Maybe someone can tell me why I am getting this error.
zip code form test
http://localhost/zip_code_auto_update.asp
Event thread: keyup
Error:
name: ReferenceError
message: Statement on line 5: Reference to undefined variable: If
Backtrace:
Line 5 of inline#2 script in
http://localhost/zip_code_auto_update.asp
If(zip.length > 4);
Line 1 of script
zipLook(this.value);
At unknown location
[statement source code not available]
<html>
<head>
<title>zip code form test</title>
<SCRIPT LANGUAGE="JavaScript" src="../_ScriptLibrary/RS.HTM"></script>
<SCRIPT LANGUAGE="JavaScript">
RSEnableRemoteScripting("../_ScriptLibrary")
</SCRIPT>
<SCRIPT TYPE="text/javascript">
function zipLook(zip)
{
If(zip.length>4)
{
var objRS = RSGetASPObject("zip_code.asp");
var objResult = objRS.lookZip(zip);
var strCityState = objResult.return_value;
var strLength = strCityState.Length;
var strEx = strCityState.indexOf('!');
var strCity = strCityState.substring(0,strEx-1);
var strST = strCityState.substring(strLength-2);
document.form1.city.value = strCity;
document.form1.state.value = strST;
document.write(strCity);
document.write(strST);
}
}
</SCRIPT>
</head>
<body>
<form name="form1" method="post">City: <input type="text" name="city"
size="30"><br />
State: <input type="text" name="state" size="4"><br />
Zip Code: <input type="text" name="zip" onKeyUp="zipLook(this.value)"
size="10"><br />
Phone: <input type="text" name="phone" size="13"><br />
</form>
</body>
</html>