...

View Full Version : problem in using checkboxes



talat
10-19-2004, 12:51 PM
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

Willy Duitt
10-19-2004, 01:33 PM
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

talat
10-19-2004, 02:16 PM
thanks buddy i am realy thankfullto you God bless you



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum