Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: select all

  1. #1
    New Coder
    Join Date
    Mar 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation select all

    hi,

    i have a html page in which a set of check boxes built dynamically from the database. even the names and values r from the database. i wanna have another check box , when i select it all other check boxes should also be selected.

    please help

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    How are the dynamic checkboxes named? Sequentially or named the same? If the names or values don't form a pattern, there is still a solution if you don't have other checkboxes in the page other than those that need to be auto-selected.
    Last edited by glenngv; 03-22-2005 at 11:45 AM.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New Coder
    Join Date
    Mar 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    select all

    the check box's values and names are very diffrent,

    but these are the only check boxes i have in my page.

    there are no other check boxes.

    regards

    san

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Code:
    function checkUncheckAll(oMasterChk){
      var chked = oMasterChk.checked;
      var chks = document.getElementsByTagName('input');
      for (var i=0; i<chks.length; i++){
        chks[i].checked = chked;
      }
      oMasterChk.title = (chked) ? "Uncheck all" : "Check all";
    }
    ...
    <input type="checkbox" name="master" onclick="checkUncheckAll(this)" title="Check all" />
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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