473,320 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

associative array problem


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);
Jul 20 '05 #1
2 1477

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);
On Wed, 13 Aug 2003, Joseph Norris wrote:

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);


Jul 20 '05 #2
In article <Pi**************************************@bolt.son ic.net>,
jo****@bolt.sonic.net enlightened us with...

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
-------------------------------------------------
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Abdullah Kauchali | last post by:
Hi folks, Can one rely on the order of keys inserted into an associative Javascript array? For example: var o = new Object(); o = "Adam"; o = "Eve";
2
by: Zenobia | last post by:
I have a problem. I need to look up several values stored in arrays. Each value is stored as a pair. The first (number) represents the probability of this item occurring. For instance, in the...
6
by: mark4asp | last post by:
Suppose I have the following code. It functions to randomly select a city based upon the probabilities given by the key differences in the associative array. . Eg. because the key difference...
5
by: mark4asp | last post by:
Suppose I wanted to create an array that was associative in 2 dimensions. The rows are associated with numbers. The columns with words. For instance for 3 columns. This array will have 20 rows...
4
by: Robert | last post by:
I am curious why some people feel that Javascript doesn't have associative arrays. I got these definitions of associative arrays via goggle: Arrays in which the indices may be numbers or...
8
by: Derek Basch | last post by:
Is there any way to associate name/value pairs during an array initialization? Like so: sType = "funFilter" filterTypeInfo = ; filterTypeInfo = new Array("type" : sType); I can do it using...
47
by: VK | last post by:
Or why I just did myArray = "Computers" but myArray.length is showing 0. What a hey? There is a new trend to treat arrays and hashes as they were some variations of the same thing. But they...
7
by: Robert Mark Bram | last post by:
Hi All! How do you get the length of an associative array? var my_cars= new Array() my_cars="Mustang"; my_cars="Station Wagon"; my_cars="SUV"; alert(my_cars.length);
41
by: Rene Nyffenegger | last post by:
Hello everyone. I am not fluent in JavaScript, so I might overlook the obvious. But in all other programming languages that I know and that have associative arrays, or hashes, the elements in...
4
by: Kozman | last post by:
I have a problem where I need to use the literal "length" as a subscript in an associative array (I have no control over what is used as a subscript..."length" happens to be one of the uncontrolled...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.