Results 1 to 4 of 4

Thread: All elements in a form?

  1. #1

    Thread Starter
    Addicted Member TheGoldenShogun's Avatar
    Join Date
    Mar 2001
    Location
    VA/MD... anywhere around the beltway
    Posts
    236

    Red face All elements in a form?

    I'm looking for a Javascript that can go through all the elements (checkboxes, textboxes, etc) in a form of mine onLoad and test to see if their value equals something, then do an action. Does anybody know a way of doing it? I have seen some form validation that use the onSubmit="functionName(this)" in the form tag but that doesn't seem to work with an onload.

  2. #2
    scoutt
    Guest
    is the form being loaded from a database?

  3. #3
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Is it something like this you are looking for?

    http://getelementbyid.com/scripts/lo...ge/index.shtml

    It counts all the items on the page and displays a loading message until its loaded.
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  4. #4

    Thread Starter
    Addicted Member TheGoldenShogun's Avatar
    Join Date
    Mar 2001
    Location
    VA/MD... anywhere around the beltway
    Posts
    236
    Thanks for the replies but I figured it out with trial and error
    Here's what I came up with (there are 55 checkboxes I'm working with).

    for (x=0; x<56; x++)
    {
    if (document.forms[0].elements[x].value == '<? echo($loadName); ?>')
    {
    doSomeStuff(now);
    }

    }

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