Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-19-2004, 11:51 AM   PM User | #1
talat
New to the CF scene

 
Join Date: Oct 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
talat is an unknown quantity at this point
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
talat is offline   Reply With Quote
Old 10-19-2004, 12:33 PM   PM User | #2
Willy Duitt
Banned

 
Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
Willy Duitt is an unknown quantity at this point
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
Willy Duitt is offline   Reply With Quote
Old 10-19-2004, 01:16 PM   PM User | #3
talat
New to the CF scene

 
Join Date: Oct 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
talat is an unknown quantity at this point
Smile thanks

thanks buddy i am realy thankfullto you God bless you
talat is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:01 AM.


Advertisement
Log in to turn off these ads.