469,289 Members | 2,330 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,289 developers. It's quick & easy.

Need a little help.

Maybe someone can tell me why I am getting this error.

zip code form test
Event thread: keyup
name: ReferenceError
message: Statement on line 5: Reference to undefined variable: If
Line 5 of inline#2 script in
If(zip.length > 4);
Line 1 of script
At unknown location
[statement source code not available]

<title>zip code form test</title>
<SCRIPT LANGUAGE="JavaScript" src="../_ScriptLibrary/RS.HTM"></script>
<SCRIPT TYPE="text/javascript">
function zipLook(zip)
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;
<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 />

Dec 9 '05 #1
1 1115

Jon Turlington wrote:
message: Statement on line 5: Reference to undefined variable: If This message gave you a hint.
<SCRIPT LANGUAGE="JavaScript" src="../_ScriptLibrary/RS.HTM"></script>
The language attribute is deprecated, use the type attribute instead:

<script type="text/javascript">
<SCRIPT TYPE="text/javascript">
function zipLook(zip)

Your problem lies here, as the hint given to you by the browser. In
javascript, things are case sensitive. It should be a lowercase I, your
'If' should be an 'if' instead.

Dec 9 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Marc | last post: by
7 posts views Thread by Keyed4U | last post: by
17 posts views Thread by EkteGjetost | last post: by
5 posts views Thread by Jintty | last post: by
7 posts views Thread by Galen Somerville | last post: by
12 posts views Thread by nephish | last post: by
reply views Thread by U S Contractors Offering Service A Non-profit | last post: by
5 posts views Thread by bean330 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.