Results 1 to 3 of 3

Thread: Getting values

  1. #1

    Thread Starter
    Addicted Member MrPresident2k's Avatar
    Join Date
    May 2002
    Location
    INDIA
    Posts
    167

    Getting values

    Hi,

    I have a form with 5 text boxes, T1 - T5, I want to take the values of the textbox in a loop, say
    for(i=1;1<=5;i++)
    {
    checking the values.
    }

    Now how to get the values in this loop? say if I have a variable

    var T= "T" + i; inside the loop, how to make this string as a textbox and get the value?

    Thanks,
    Pres

  2. #2
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196
    you could have 5 text boxes the same name
    which then become an array.
    Code:
    for i=0;i<5;i++)
     document.formname.txtname[i].value;

  3. #3

    Thread Starter
    Addicted Member MrPresident2k's Avatar
    Join Date
    May 2002
    Location
    INDIA
    Posts
    167

    I tried this 1

    Hi,

    Thanks for your reply, I tried with this 1 and it worked.

    Code:
    for (i=0;i<5;i++)
    {
       T="T" + i;
       document.formname.item(T).value;
    }
    This gave me the value.

    Thanks,
    Pres.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width