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 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2002
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Is there a shortcut key to select all checkboxes in a form?

    Like the question says, is there some sort of shortcurt like a key combo or something else to select all checkboxes in a form at once instead of having to click one at a time?

    Thank you in advance.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There is no browser specific shortcut, but you can use JavaScript to perfrom that function. Here is an example where all the checkbox's have the same name:
    <html>
    <head>
    <title>Check All</title>
    <SCRIPT LANGUAGE="JavaScript">
    function checkall(formid)
    {
    len=formid.ckb.length
    for(i=0;i<len;i++)
    {
    formid.elements.ckb[i].checked=true
    }
    }
    function uncheckall(formid)
    {
    len=formid.ckb.length
    for(i=0;i<len;i++)
    {
    formid.elements.ckb[i].checked=false
    }
    }
    </SCRIPT>
    </head>
    <body>
    <CENTER>
    <FORM NAME="myform">
    <INPUT TYPE="checkbox" NAME="ckb"> Checkbox One
    <BR>
    <INPUT TYPE="checkbox" NAME="ckb"> Checkbox Two
    <BR>
    <INPUT TYPE="checkbox" NAME="ckb"> Checkbox Three
    <BR>
    <INPUT TYPE="button" NAME="chka" VALUE="Check All" onClick="checkall(this.form)">
    <INPUT TYPE="button" NAME="unchka" VALUE="Uncheck All" onClick="uncheckall(this.form)">
    </FORM>
    </CENTER>
    </body>
    </html>

  • #3
    New Coder
    Join Date
    Jul 2002
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks.


  •  

    Posting Permissions

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