associative array problem

J

Joseph Norris

Hello to all,


I am having a problem with this test html below. When I enter a correct
city I keep getting an "Object expected" error on the town field.

Any and all comments appreciated. Is there a better way to do this?

Thanks.


<html>
<head>
<title>Test</title

<SCRIPT language="JAVASCRIPT">

<!-- //

function PutZip(t){
var find_zip = new Array();
find_zip["ALBION"] = "95410";
find_zip["BOONVILLE"] = "95415";
document.testForm.zip.value = find_zip[t];
}

// -->

</SCRIPT>

</head>

<BODY>
<form action="" name="testForm">
<input type="text" name="town" size="30" maxlength="30" onblur="return PutZip(this.value)">
<input type="text" name="zip" size="30" maxlength="30">
</form>
</body>
</html>

#Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql)
print @c=map chr $_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,
-68,4,-3,-1,7,1,14,-68,-26,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);
 
K

kaeli

Hello to all,


I am having a problem with this test html below. When I enter a correct
city I keep getting an "Object expected" error on the town field.

Any and all comments appreciated. Is there a better way to do this?

Thanks.

You forgot to end the title tag's last ">". Fix that and it works.
<html>
<head>
<title>Test</title>

<SCRIPT language="JAVASCRIPT">

<!-- //

function PutZip(t){
var find_zip = new Array();
find_zip["ALBION"] = "95410";
find_zip["BOONVILLE"] = "95415";
document.testForm.zip.value = find_zip[t];
}

// -->

</SCRIPT>

</head>

<BODY>
<form action="" name="testForm">
<input type="text" name="town" size="30" maxlength="30"
onblur="return PutZip(this.value)">
<input type="text" name="zip" size="30" maxlength="30">
</form>
</body>
</html>

-------------------------------------------------
~kaeli~
Why do people who know the least know it the loudest?
If that cell phone was up your a$$, maybe you could
drive a little better!
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
 
J

Joseph Norris

Found the problem and again has made me even more cautious about using
javascript. I forgot the ">" on title - IE kicked it back but netscape
accepted it. Yuck!!!!


#Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql)
print @c=map chr $_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,
-68,4,-3,-1,7,1,14,-68,-26,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,206
Latest member
Zenden

Latest Threads

Top