Loading arrays

Discussion in 'JavaScript' started by lost, Nov 24, 2005.

  1. #1
    i have a group of dynamically created textfields tagged by an "id=idesc",
    and another group of dynamically created textfields tagged by an "id=ipno".

    what i need to do is loop through the number of created textfields (numItems) and store the results in an array.

    I'd like to have each array element to consist of a desc and a pno
    so the array would look like this:

    array[0] = desc1, pno1
    array[1] - desc2, pno2
    array[2] - desc3, pno3
    array[3] - desc4, pno4
    .
    .
    .
    array[n] - descn, pnon

    Could someone tell me how to fix this code:

    
      function submitSave()
      {
         var i;
         var iarray  = new Array();
         var iDescriptionValue = new Array();
         var iPartnoValue = new Array();
    
         for (i=0; i<numItems; i++)
         {
             document.getElementById("idesc") = iDescriptionValue;
             document.getElementById("ipno")  = iPartnoValue;
             iarray[i] = array(iDescriptionValue, iPartnoValue);
             alert(iarray);
         }
    }
    
    Code (markup):

     
    lost, Nov 24, 2005 IP
  2. lost

    lost Peon

    Messages:
    144
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    How do i extract the value from a textfield?
     
    lost, Nov 30, 2005 IP