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

Thread: check box

  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Location
    Pakistan
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts

    check box

    hi all

    Example: mail.yahoo.com
    when we go to inbox page of mail.yahoo.com, if we have messages in our inbox, they come in the form of checkboxes one after another.
    if we wanna delete one message, we select the checkbox of that message and press the delete button.
    if we wanna delete all messages then we select the top checkbox and all the check boxes get selected.
    i wanna know this how to select all check boxes on the selection of one check box.
    Regards,
    Aamir
    God helps those who help others.

  • #2
    Regular Coder zro@rtv's Avatar
    Join Date
    Feb 2005
    Location
    on the network
    Posts
    433
    Thanks
    0
    Thanked 1 Time in 1 Post
    http://www.google.com/search?q=select+all+checkbox

    is java script an option?
    is there a link?
    does that link answer yr question?
    ._-zro
    zro@redtv
    zro.redtv.org

    "If HTML and the Web made all the online documents look like one huge book, RDF, schema, and inference languages will make all the data in the world look like one huge database"
    -Tim Berners-Lee, Weaving the Web, 1999

  • #3
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,745
    Thanks
    0
    Thanked 244 Times in 239 Posts
    Hi there amir,

    try this little script, it may give you some ideas...
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/1999/REC-html401-19991224">
    <html>
    <head>
    <title>check all</title>
    
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <meta name="Content-Script-Type" content="text/javascript">
    <meta name="Content-Style-Type" content="text/css">
    
    <script type="text/javascript">
    <!--
    
      var chk=document.getElementsByTagName('input');
    
    function checkAll() {
    if(document.forms[0][0].checked==true) {
    for(i=0;i<chk.length;i++) {
    if(chk[i].type=='checkbox') {
       chk[i].checked=true;
        }
       }
      }
    else {
    for(i=0;i<chk.length;i++) {
    if(chk[i].type=='checkbox') {
       chk[i].checked=false;
        }
       }
      }
     }
    //-->
    </script>
    
    </head>
    <body>
    
    <form action="#">
    
    <ul>
    <li><input type="checkbox" onclick="checkAll()"><label>check all</label></li>
    <li><input type="checkbox"></li>
    <li><input type="checkbox"></li>
    <li><input type="checkbox"></li>
    <li><input type="checkbox"></li>
    <li><input type="checkbox"></li>
    </ul>
    
    </form>
    
    </body>
    </html>
    Edit: reason for edit - original script did not allow for the unchecking of the check all box


    coothead
    Last edited by coothead; 07-16-2005 at 07:35 PM.


  •  

    Posting Permissions

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