[Javascript] Javascript digest, Vol 1 #458 - 3 msgs

sandra_tibbs at abicon.com sandra_tibbs at abicon.com
Tue Dec 17 11:40:45 CST 2002


(Embedded image moved to file: pic13458.jpg)
Send Javascript mailing list submissions to
      javascript at LaTech.edu

To subscribe or unsubscribe via the World Wide Web, visit
      http://www.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. Re:Selects and Arrays (Bill Marriott)
   2. RE: Re:Selects and Arrays (Mckinney, Lori K)
   3. Re: Selects and Arrays. . (Bill Marriott)

--__--__--

Message: 1
From: "Bill Marriott" <bill.marriott at optusnet.com.au>
To: <javascript at LaTech.edu>
Date: Sat, 17 Nov 2001 09:29:49 +1100
Subject: [Javascript] Re:Selects and Arrays
Reply-To: javascript at LaTech.edu

Hi Everyone,

I'm having trouble with dynaically adding options to a second select
depending on the choice of the first select.
Can anyone see why the code below dosen't work.
(It works without the "for" looping. )

thanks
Bill

var sprayChoice = new Array();

      sprayChoice[0]= new Array();
           sprayChoice[0][0]=13;
           sprayChoice[0][1]="Cosmos";
           sprayChoice[0][2]=4;

      sprayChoice[1]= new Array();
           sprayChoice[1][0]=9;
           sprayChoice[1][1]="DAP";
           sprayChoice[1][2]=3;

      sprayChoice[2]= new Array();
           sprayChoice[2][0]=1;
           sprayChoice[2][1]="Glysophate 450";
           sprayChoice[2][2]=1;

      sprayChoice[3]= new Array();
           sprayChoice[3][0]=11;
           sprayChoice[3][1]="Lorsban";
           sprayChoice[3][2]=2;

      sprayChoice[4]= new Array();
           sprayChoice[4][0]=8;
           sprayChoice[4][1]="MAP";
           sprayChoice[4][2]=3;

      sprayChoice[5]= new Array();
           sprayChoice[5][0]=10;
           sprayChoice[5][1]="Red Pickle";
           sprayChoice[5][2]=4;

      sprayChoice[6]= new Array();
           sprayChoice[6][0]=7;
           sprayChoice[6][1]="Spray seed";
           sprayChoice[6][2]=1;

      sprayChoice[7]= new Array();
           sprayChoice[7][0]=12;
           sprayChoice[7][1]="Talstar";
           sprayChoice[7][2]=2;


var totalRows=8;
var filter = 0 ;

function setProductOptions()
{
 filter=document.newTable.sprayType.value;
 var i;
  for (i=0; i=totalRows; i++)
   {
      if ( filter = sprayChoice[i][3])
         {
           var pOption=document.createElement("OPTION");
           pOption.value=sprayChoice[i][0];
           pOption.text=sprayChoice[i][1];
           document.newTable.SPRAYPRODUCT.options.add(pOption);
         }
   }
}
</SCRIPT>

<tr ID="sprayRow">
            <td width="13%">
              <select size="1" name="sprayType"
onChange="setProductOptions()">
               <option selected value=""></option>

      <option value=3>Fertilizer</option>

      <option value=1>Herbicide</option>

      <option value=2>Insecticide</option>

      <option value=4>Seed Treatment</option>

               </select>
            </td>
            <td width="14%">
              <select size="1" name="SPRAYPRODUCT" ID="selectSprayProd" >
               <option selected value=""></option>
               </select>
            </td>


--__--__--

Message: 2
From: "Mckinney, Lori K" <lkmckinn at ingr.com>
To: javascript at LaTech.edu
Subject: RE: [Javascript] Re:Selects and Arrays
Date: Fri, 16 Nov 2001 16:54:52 -0600
Reply-To: javascript at LaTech.edu

Bill,

Is this just a typo in your mail?  Shouldn't it be ==?

      if ( filter = sprayChoice[i][3])

-----Original Message-----
From: Bill Marriott [mailto:bill.marriott at optusnet.com.au]
Sent: Friday, November 16, 2001 4:30 PM
To: javascript at LaTech.edu
Subject: [Javascript] Re:Selects and Arrays


Hi Everyone,

I'm having trouble with dynaically adding options to a second select
depending on the choice of the first select.
Can anyone see why the code below dosen't work.
(It works without the "for" looping. )

thanks
Bill

var sprayChoice = new Array();

      sprayChoice[0]= new Array();
           sprayChoice[0][0]=13;
           sprayChoice[0][1]="Cosmos";
           sprayChoice[0][2]=4;

      sprayChoice[1]= new Array();
           sprayChoice[1][0]=9;
           sprayChoice[1][1]="DAP";
           sprayChoice[1][2]=3;

      sprayChoice[2]= new Array();
           sprayChoice[2][0]=1;
           sprayChoice[2][1]="Glysophate 450";
           sprayChoice[2][2]=1;

      sprayChoice[3]= new Array();
           sprayChoice[3][0]=11;
           sprayChoice[3][1]="Lorsban";
           sprayChoice[3][2]=2;

      sprayChoice[4]= new Array();
           sprayChoice[4][0]=8;
           sprayChoice[4][1]="MAP";
           sprayChoice[4][2]=3;

      sprayChoice[5]= new Array();
           sprayChoice[5][0]=10;
           sprayChoice[5][1]="Red Pickle";
           sprayChoice[5][2]=4;

      sprayChoice[6]= new Array();
           sprayChoice[6][0]=7;
           sprayChoice[6][1]="Spray seed";
           sprayChoice[6][2]=1;

      sprayChoice[7]= new Array();
           sprayChoice[7][0]=12;
           sprayChoice[7][1]="Talstar";
           sprayChoice[7][2]=2;


var totalRows=8;
var filter = 0 ;

function setProductOptions()
{
 filter=document.newTable.sprayType.value;
 var i;
  for (i=0; i=totalRows; i++)
   {
      if ( filter = sprayChoice[i][3])
         {
           var pOption=document.createElement("OPTION");
           pOption.value=sprayChoice[i][0];
           pOption.text=sprayChoice[i][1];
           document.newTable.SPRAYPRODUCT.options.add(pOption);
         }
   }
}
</SCRIPT>

<tr ID="sprayRow">
            <td width="13%">
              <select size="1" name="sprayType"
onChange="setProductOptions()">
               <option selected value=""></option>

      <option value=3>Fertilizer</option>

      <option value=1>Herbicide</option>

      <option value=2>Insecticide</option>

      <option value=4>Seed Treatment</option>

               </select>
            </td>
            <td width="14%">
              <select size="1" name="SPRAYPRODUCT" ID="selectSprayProd" >
               <option selected value=""></option>
               </select>
            </td>

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
http://www.LaTech.edu/mailman/listinfo/javascript

--__--__--

Message: 3
From: "Bill Marriott" <bill.marriott at optusnet.com.au>
To: <javascript at LaTech.edu>
Date: Sat, 17 Nov 2001 14:32:52 +1100
Subject: [Javascript] Re: Selects and Arrays. .
Reply-To: javascript at LaTech.edu

Thanks Lori,

It was not a typo just a mistake( I haven't done much in Javascript for a
while)
There was also a similar one in the "for" logic.
Thanks for pointing it out.

Bill



--__--__--

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
http://www.LaTech.edu/mailman/listinfo/javascript


End of Javascript Digest
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic13458.jpg
Type: image/jpeg
Size: 1868 bytes
Desc: not available
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20021217/733a9e5c/attachment.jpg>


More information about the Javascript mailing list