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 to the CF scene
    Join Date
    Oct 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy problem in using checkboxes

    hi friend
    actually what i was trying to do is
    BY CLICKING ON ONE CHECK BOX ALL THE REMAINING CHECKBOX SHOULD ALSO BE SELECTED OR DESELECTED as it is in our inbox page of mail accounts .But its not worling for me plz see my code and do reply i need help
    //my code is the script portion is
    <script language="javascript">
    function all()
    {
    if(document.form1.base.checked==true)
    for(i=0;i<document.form1.powers.lenghth;i++)
    {
    document.form1.powers[i].checked=true;
    }
    else
    for(i=0;i<document.form1.powers.lenghth;i++)
    {
    document.form1.powers[i].checked=false;
    }
    }
    </script>
    //the form portion is
    <form name="form1" method="post" action="">
    <p>
    <input name="base" type="checkbox" onclick="all()">
    select/deselect</p>
    <p>
    <input name="powers" type="checkbox" >
    Mody </p>
    <p>
    <input name="powers" type="checkbox" >
    Talat</p>
    <p>
    <input name="powers" type="checkbox" >
    Qamar</p>
    <p>
    <input name="powers" type="checkbox" >
    Jaffer</p>
    <p>
    <input name="powers" type="checkbox" >
    Babbooo
    </p>
    </form>

    i want that when click the BASE check box all the other get select or deselect
    WATING FOR REPLY

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Change the name of your function... all is a reserved word..

    You have mispelled length in both of your for loops...

    for(i=0;i<document.form1.powers.lenghth;i++)


    .....Willy

  • #3
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile thanks

    thanks buddy i am realy thankfullto you God bless you


  •  

    Posting Permissions

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