[Javascript] Looping through associative arrays
Senior, Henry (TWIi London)
HSenior at twii.net
Tue Jun 25 12:09:04 CDT 2002
To loop through an associative array you have to use a for in loop.
This will loop through every property in the array and it will treat
array.length as a property too.
To just loop through *just* the elements in the array you can do this:
for(i in assocArray){
if(i!='length'){
//statements about assocArray[i]
//i will be the name of each property
}
}
-----Original Message-----
From: javascript-request at LaTech.edu
[mailto:javascript-request at LaTech.edu]
Sent: 25 June 2002 18:01
To: javascript at LaTech.edu
Subject: Javascript digest, Vol 1 #685 - 8 msgs
Send Javascript mailing list submissions to
javascript at LaTech.edu
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.LaTech.edu/mailman/listinfo/javascript
or, via email, send a message with subject or body 'help' to
javascript-request at LaTech.edu
You can reach the person managing the list at
javascript-admin at LaTech.edu
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Javascript digest..."
Today's Topics:
1. (no subject) (Philip Domenico)
2. Re: (no subject) (Rodney Myers)
3. this gives me an error object doesn't support thsi property or
mether (Scott.Wiseman)
4. RE: this gives me an error object doesn't support thsi property or
mether (Peter Brunone)
5. getting layer contents in NS 4.7 (andyg at ihug.co.nz)
6. Re: getting layer contents in NS 4.7 (Peter-Paul Koch)
7. Re: getting layer contents in NS 4.7 (andyg at ihug.co.nz)
--__--__--
Message: 1
From: "Philip Domenico" <phildom at nortelnetworks.com>
To: "'javascript at LaTech.edu'" <javascript at LaTech.edu>
Date: Mon, 24 Jun 2002 12:24:50 -0500
Subject: [Javascript] (no subject)
Reply-To: javascript at LaTech.edu
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C21BA4.0BF41FD0
Content-Type: text/plain;
charset="iso-8859-1"
Amanda,
Did you ever get an answer to your question regarding looping through
associative arrays in Javascript?
I sure would appreciate any direction you could provide.
Thanks,
Regards,
philDomenico, OCP
ESN 445-6727
972-685-6727
Nortel Networks - NetOnline
------_=_NextPart_001_01C21BA4.0BF41FD0
Content-Type: text/html;
charset="iso-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN
class=953302817-24062002>Amanda,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=953302817-24062002></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=953302817-24062002>Did you ever get
an
answer to your question regarding looping through associative arrays in
Javascript?<BR>I sure would appreciate any direction you could
provide.<BR><BR>Thanks,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2>Regards,<BR><FONT size=4><FONT
face=Tahoma><FONT
size=3>phil<STRONG>Domenico</STRONG>,</FONT> <FONT
size=3>OCP</FONT></FONT></FONT></FONT></DIV>
<DIV>
<DIV><FONT face=Arial size=2>ESN 445-6727</FONT></DIV></DIV>
<DIV><FONT face=Arial size=2>972-685-6727</FONT></DIV>
<DIV><FONT face=Arial><STRONG><EM>Nortel Networks -</EM></STRONG>
<STRONG>NetOnline</STRONG></FONT></DIV>
<DIV> </DIV></BODY></HTML>
------_=_NextPart_001_01C21BA4.0BF41FD0--
--__--__--
Message: 2
Date: Mon, 24 Jun 2002 18:43:11 +0100
From: Rodney Myers <rodney at aflyingstart.net>
To: javascript at LaTech.edu
Subject: Re: [Javascript] (no subject)
Reply-To: javascript at LaTech.edu
--------------B9F968DB77DD28CDB6F838AC
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
for(var associativeTag in arrayName)
hth
Rodney
Philip Domenico wrote:
> Amanda,Did you ever get an answer to your question regarding looping
> through associative arrays in Javascript?
> I sure would appreciate any direction you could provide.
>
> Thanks,Regards,
> philDomenico, OCPESN 445-6727972-685-6727Nortel Networks - NetOnline
--------------B9F968DB77DD28CDB6F838AC
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
for(var associativeTag in arrayName)
<p>hth
<p>Rodney
<p>Philip Domenico wrote:
<blockquote TYPE=CITE> <span
class=953302817-24062002><font face="Arial"><font
size=-1>Amanda,</font></font></span><span
class=953302817-24062002></span><span class=953302817-24062002><font
face="Arial"><font size=-1>Did
you ever get an answer to your question regarding looping through
associative
arrays in Javascript?</font></font>
<br><font face="Arial"><font size=-1>I sure would appreciate any direction
you could provide.</font></font>
<p><font face="Arial"><font size=-1>Thanks,</font></font></span><font
face="Arial"><font size=-1>Regards,</font></font>
<br><font face="Tahoma"><font size=+0>phil<b>Domenico</b>,</font><font
size=+1>
</font><font size=+0>OCP</font></font><font face="Arial"><font size=-1>ESN
445-6727</font></font><font face="Arial"><font
size=-1>972-685-6727</font></font><font face="Arial"><b><i>Nortel
Networks -</i></b> <b>NetOnline</b></font> </blockquote>
</html>
--------------B9F968DB77DD28CDB6F838AC--
--__--__--
Message: 3
From: "Scott.Wiseman" <swiseman at remax-cahi.com>
To: "'javascript at LaTech.edu'" <javascript at LaTech.edu>
Date: Mon, 24 Jun 2002 17:58:36 -0700
Subject: [Javascript] this gives me an error object doesn't support thsi
property or
mether
Reply-To: javascript at LaTech.edu
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C21BE3.6F983F50
Content-Type: text/plain;
charset="iso-8859-1"
[Scott.Wiseman]
object doesn't support thsi property or mether
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Update a Transaction</title>
<script language =javascript>
<% if len(gcc)> 0 and len(recordnumber)>0 then %>
window.opener.putintoarray(150,6545646);
<% end if %>
setTimeout('self.close();',3000);
</script>
</head>
<body >
</body>
</html>
------_=_NextPart_001_01C21BE3.6F983F50
Content-Type: text/html;
charset="iso-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4912.300" name=GENERATOR></HEAD>
<BODY><FONT color=#0000c0>
<P><BR><FONT size=2><SPAN class=984585700-25062002><FONT face=Arial
color=#0000ff>[Scott.Wiseman] </FONT></SPAN></FONT></P>
<P><FONT size=2><SPAN class=984585700-25062002></SPAN></FONT> </P>
<P><FONT size=2><SPAN class=984585700-25062002>object doesn't support thsi
property or mether</SPAN></FONT></P>
<P><FONT size=2><SPAN
class=984585700-25062002> </SPAN><html></FONT></P></FONT><FONT
color=#000000></FONT><FONT color=#0000c0>
<P><FONT size=2><head></FONT></P>
<P><FONT size=2><meta http-equiv=</FONT></FONT><FONT size=2><FONT
color=#000000>"Content-Language"</FONT><FONT color=#0000c0>
content=</FONT><FONT
color=#000000>"en-us"</FONT></FONT><FONT color=#0000c0><FONT
size=2>></FONT></P>
<P><FONT size=2><meta http-equiv=</FONT></FONT><FONT size=2><FONT
color=#000000>"Content-Type"</FONT><FONT color=#0000c0> content=</FONT><FONT
color=#000000>"text/html; charset=windows-1252"</FONT></FONT><FONT
color=#0000c0><FONT size=2>></FONT></P>
<P><FONT size=2><meta name=</FONT></FONT><FONT size=2><FONT
color=#000000>"GENERATOR"</FONT><FONT color=#0000c0> content=</FONT><FONT
color=#000000>"Microsoft FrontPage 4.0"</FONT></FONT><FONT
color=#0000c0><FONT
size=2>></FONT></P>
<P><FONT size=2><meta name=</FONT></FONT><FONT size=2><FONT
color=#000000>"ProgId"</FONT><FONT color=#0000c0> content=</FONT><FONT
color=#000000>"FrontPage.Editor.Document"</FONT></FONT><FONT
color=#0000c0><FONT
size=2>></FONT></P>
<P><FONT size=2><title></FONT></FONT><FONT size=2><FONT
color=#000000>Update a Transaction</FONT><FONT
color=#0000c0></title></P></FONT><FONT
color=#000000></FONT></FONT><FONT
color=#0000c0>
<P><FONT size=2><script language =javascript></FONT></FONT><FONT
color=#800000><FONT size=2> </FONT></P>
<P><FONT size=2><% if len(gcc)> 0 and len(recordnumber)>0 then
%></FONT></P>
<P><FONT size=2>window.opener.putintoarray(150,6545646); </FONT></P>
<P><FONT size=2></FONT></P>
<P><FONT size=2><% end if %></FONT></P>
<P><FONT size=2>setTimeout('self.close();',3000);</FONT></P>
<P><FONT size=2></FONT></P></FONT><FONT color=#0000c0 size=2>
<P></script></P></FONT><FONT color=#000000 size=2>
<P> </P></FONT><FONT color=#0000c0>
<P><FONT size=2></head></FONT></P>
<P><FONT size=2><body ></FONT></P></FONT><FONT
color=#000000></FONT><FONT
color=#0000c0>
<P><FONT size=2></body></FONT></P>
<P><FONT size=2></html></FONT></P></FONT><FONT
color=#000000></FONT></BODY></HTML>
------_=_NextPart_001_01C21BE3.6F983F50--
--__--__--
Message: 4
From: "Peter Brunone" <peter at brunone.com>
To: <javascript at LaTech.edu>
Subject: RE: [Javascript] this gives me an error object doesn't support
thsi property or mether
Date: Mon, 24 Jun 2002 20:42:56 -0500
Organization: Your Name Here
Reply-To: javascript at LaTech.edu
This is a multi-part message in MIME format.
------=_NextPart_000_005C_01C21BBF.B81BFA60
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Scott,
Are gcc and recordnumber just variables? If so, then use their length
property, i.e. gcc.length . You're probably thinking of the VBScript Len()
function for strings.
Cheers,
Peter
-----Original Message-----
From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
Behalf Of Scott.Wiseman
Sent: Monday, June 24, 2002 7:59 PM
To: 'javascript at LaTech.edu'
Subject: [Javascript] this gives me an error object doesn't support thsi
property or mether
[Scott.Wiseman]
object doesn't support thsi property or mether
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Update a Transaction</title>
<script language =javascript>
<% if len(gcc)> 0 and len(recordnumber)>0 then %>
window.opener.putintoarray(150,6545646);
<% end if %>
setTimeout('self.close();',3000);
</script>
</head>
<body >
</body>
</html>
------=_NextPart_000_005C_01C21BBF.B81BFA60
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D360243601-25062002>Scott,</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D360243601-25062002></SPAN></FONT> </DIV>
<DIV> <SPAN class=3D360243601-25062002><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>Are gcc and recordnumber just variables? =
If so, then=20
use their length property, i.e. gcc.length . You're probably =
thinking of=20
the VBScript Len() function for strings.</FONT></SPAN></DIV>
<DIV><SPAN class=3D360243601-25062002><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D360243601-25062002><FONT face=3DArial color=3D#0000ff =
size=3D2>Cheers,</FONT></SPAN></DIV>
<DIV><SPAN class=3D360243601-25062002><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D360243601-25062002><FONT face=3DArial color=3D#0000ff =
size=3D2>Peter</FONT></SPAN></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px">
<DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
size=3D2>-----Original Message-----<BR><B>From:</B> =
javascript-admin at LaTech.edu=20
[mailto:javascript-admin at LaTech.edu]<B>On Behalf Of=20
</B>Scott.Wiseman<BR><B>Sent:</B> Monday, June 24, 2002 7:59 =
PM<BR><B>To:</B>=20
'javascript at LaTech.edu'<BR><B>Subject:</B> [Javascript] this gives me =
an error=20
object doesn't support thsi property or =
mether<BR><BR></FONT></DIV><FONT=20
color=3D#0000c0>
<P><BR><FONT size=3D2><SPAN class=3D984585700-25062002><FONT =
face=3DArial=20
color=3D#0000ff>[Scott.Wiseman] </FONT></SPAN></FONT></P>
<P><FONT size=3D2><SPAN =
class=3D984585700-25062002></SPAN></FONT> </P>
<P><FONT size=3D2><SPAN class=3D984585700-25062002>object doesn't =
support thsi=20
property or mether</SPAN></FONT></P>
<P><FONT size=3D2><SPAN=20
=
class=3D984585700-25062002> </SPAN><html></FONT></P></FONT><FO=
NT=20
color=3D#000000></FONT><FONT color=3D#0000c0>
<P><FONT size=3D2><head></FONT></P>
<P><FONT size=3D2><meta http-equiv=3D</FONT></FONT><FONT =
size=3D2><FONT=20
color=3D#000000>"Content-Language"</FONT><FONT color=3D#0000c0>=20
content=3D</FONT><FONT color=3D#000000>"en-us"</FONT></FONT><FONT=20
color=3D#0000c0><FONT size=3D2>></FONT></P>
<P><FONT size=3D2><meta http-equiv=3D</FONT></FONT><FONT =
size=3D2><FONT=20
color=3D#000000>"Content-Type"</FONT><FONT color=3D#0000c0> =
content=3D</FONT><FONT=20
color=3D#000000>"text/html; charset=3Dwindows-1252"</FONT></FONT><FONT =
color=3D#0000c0><FONT size=3D2>></FONT></P>
<P><FONT size=3D2><meta name=3D</FONT></FONT><FONT size=3D2><FONT=20
color=3D#000000>"GENERATOR"</FONT><FONT color=3D#0000c0> =
content=3D</FONT><FONT=20
color=3D#000000>"Microsoft FrontPage 4.0"</FONT></FONT><FONT =
color=3D#0000c0><FONT=20
size=3D2>></FONT></P>
<P><FONT size=3D2><meta name=3D</FONT></FONT><FONT size=3D2><FONT=20
color=3D#000000>"ProgId"</FONT><FONT color=3D#0000c0> =
content=3D</FONT><FONT=20
color=3D#000000>"FrontPage.Editor.Document"</FONT></FONT><FONT=20
color=3D#0000c0><FONT size=3D2>></FONT></P>
<P><FONT size=3D2><title></FONT></FONT><FONT size=3D2><FONT=20
color=3D#000000>Update a Transaction</FONT><FONT=20
color=3D#0000c0></title></P></FONT><FONT =
color=3D#000000></FONT></FONT><FONT=20
color=3D#0000c0>
<P><FONT size=3D2><script language =
=3Djavascript></FONT></FONT><FONT=20
color=3D#800000><FONT size=3D2> </FONT></P>
<P><FONT size=3D2><% if len(gcc)> 0 and len(recordnumber)>0 =
then=20
%></FONT></P>
<P><FONT size=3D2>window.opener.putintoarray(150,6545646); </FONT></P>
<P><FONT size=3D2></FONT></P>
<P><FONT size=3D2><% end if %></FONT></P>
<P><FONT size=3D2>setTimeout('self.close();',3000);</FONT></P>
<P><FONT size=3D2></FONT></P></FONT><FONT color=3D#0000c0 size=3D2>
<P></script></P></FONT><FONT color=3D#000000 size=3D2>
<P> </P></FONT><FONT color=3D#0000c0>
<P><FONT size=3D2></head></FONT></P>
<P><FONT size=3D2><body ></FONT></P></FONT><FONT=20
color=3D#000000></FONT><FONT color=3D#0000c0>
<P><FONT size=3D2></body></FONT></P>
<P><FONT size=3D2></html></FONT></P></BLOCKQUOTE></FONT><FONT=20
color=3D#000000></FONT></BODY></HTML>
------=_NextPart_000_005C_01C21BBF.B81BFA60--
--__--__--
Message: 5
To: javascript at LaTech.edu
From: andyg at ihug.co.nz
Date: Tue, 25 Jun 2002 07:10:54 GMT
Subject: [Javascript] getting layer contents in NS 4.7
Reply-To: javascript at LaTech.edu
is there a way to get layer contents/html in NS 4.7
I know is 6.0 it would be
var txt=document.getElementById(mydiv).innerHTML
is there an equivalent in v 4.7 ?
Andrew Gibson
--__--__--
Message: 6
From: "Peter-Paul Koch" <gassinaumasis at hotmail.com>
To: javascript at LaTech.edu
Subject: Re: [Javascript] getting layer contents in NS 4.7
Date: Tue, 25 Jun 2002 07:16:10 +0000
Reply-To: javascript at LaTech.edu
>is there a way to get layer contents/html in NS 4.7
>
>I know is 6.0 it would be
>
>var txt=document.getElementById(mydiv).innerHTML
>
>is there an equivalent in v 4.7 ?
No, it's totally impossible to get in NN4.
ppk
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
--__--__--
Message: 7
To: javascript at LaTech.edu
From: andyg at ihug.co.nz
Subject: Re: [Javascript] getting layer contents in NS 4.7
Date: Tue, 25 Jun 2002 07:27:28 GMT
Reply-To: javascript at LaTech.edu
ah, suspected as much, thanks Peter. Can use arrays I suppose.
>
> >is there a way to get layer contents/html in NS 4.7
> >
> >I know is 6.0 it would be
> >
> >var txt=document.getElementById(mydiv).innerHTML
> >
> >is there an equivalent in v 4.7 ?
>
> No, it's totally impossible to get in NN4.
>
> ppk
--__--__--
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
End of Javascript Digest
DISCLAIMER - The preceding e-mail message (including any attachments)
contains information that may be confidential, may be protected by the
attorney-client or other applicable privileges, or may constitute non-public
information. It is intended to be conveyed only to the designated
recipient(s) named above. If you are not an intended recipient of this
message, or have otherwise received it in error, please notify the sender by
replying to this message and then delete all copies of it from your computer
system. Any use, dissemination, distribution, or reproduction of this
message by unintended recipients is not authorized and may be unlawful. The
contents of this communication do not necessarily represent the views of
this company.
More information about the Javascript
mailing list