[Javascript] nested "for" statements

Muchacho, Laurent (TWIi London) LMuchacho at twii.net
Wed May 29 04:18:20 CDT 2002


Hi Bill

That possible but you need to use a differente variable for the nested loop

for(var i=0;i<object.length;i++){
	alert(object[i]);
	for(var j=0;j<object2.length;j++){
		alert(object2[j])
	}

}

Laurent 



-----Original Message-----
From: Bill Marriott [mailto:bill.marriott at optusnet.com.au]
Sent: 30 May 2002 02:47
To: javascript at LaTech.edu
Subject: Re: [Javascript] nested "for" statements


Hi Everyone,

I'm trying to get nested "for" statements to run in order to get the
selected options from a number of  multiple select boxes. See code below.
Does anyone know if it isn't possible? At present it only runs for the first
select box.

regards

Bill

for(i=1;i<=document.Crystal.NumOfParM.value;i++)
   {
     var ObjM = document.getElementById("paraM" +i);
     if (ObjM != "" || ObjM != null)
      {
        for (var i=0, l=ObjM.options.length;i<l;i++)
           {
             if (ObjM.options[i].selected)
                {
                  valSF = valSF + "AND" + ObjM.options[i].value;
                }
           }
      }
   }


_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript


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