select all check boxes at a time with check all [Javascript] [Chatakondu Gallery]

Discussion in 'Javascript' started by Suresh, Apr 16, 2004.

  1. Suresh

    Suresh Guest

    formName: Form name
    controlCheckAll: check all checkbox (parent) control name
    controlCheckOne: child checkbox control name

    // To check and uncheck all check boxes. Form name is optional.
    function fnCheckUnCheckAllCheckBoxes(formName, controlCheckAll, controlCheckOne)
    {
    if (formName == '')
    var formName = document.forms(0).name
    obj = eval("document." + formName)

    var objCheckAll = eval("document." + formName + "." + controlCheckAll)

    for (var i=0;i<obj.elements.length;i++)
    {
    var e = obj.elements;
    var elementName = e.name.toString()

    if (elementName.indexOf(controlCheckOne) >= 0 )
    e.checked = objCheckAll.checked;
    }
    }
    Suresh, Apr 16, 2004
    #1
    1. Advertising

  2. Suresh

    kaeli Guest

    kaeli, Apr 16, 2004
    #2
    1. Advertising

  3. Suresh

    Suresh Guest

    N/A
    Suresh, Apr 22, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kris
    Replies:
    0
    Views:
    501
  2. kris
    Replies:
    0
    Views:
    464
  3. Suresh
    Replies:
    1
    Views:
    130
    Richard Cornford
    Apr 16, 2004
  4. Suresh
    Replies:
    0
    Views:
    159
    Suresh
    Apr 16, 2004
  5. Replies:
    2
    Views:
    118
Loading...

Share This Page