Click to See Complete Forum and Search --> : check All


RJ2003
06-02-2003, 04:31 AM
Hi ppl,

I want to check "All" and it should check all other check boxes....like in hotmail when we select all and it checks all mails.

Thanks.

Charles
06-02-2003, 05:49 AM
Of course, it will not work 13% of the time, so you'll still have to do some processing server side.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Example</title>
<style type="text/css">
<!--
label{display:block}
-->
</style>
<form action="">
<div>
<label><input type="checkbox">Fee</label>
<label><input type="checkbox">Fie</label>
<label><input type="checkbox">Foe</label>
<label><input type="checkbox">Fum</label>
</div>
<p>
<label><input type="checkbox" name=" all" onclick="for (j=0; j<this.form.elements.length-1; j++) {this.form.elements[j].checked = this.checked}">Select All</label>
</p>
</form>

RJ2003
06-02-2003, 06:42 AM
Thanks Charles,

But this will check mark all checkboxes prsent in the form. There are in total 8 checkboxes (with different names) and I want this ALL checkbox to check 5 (again with diff names) of the total 8 checkboxes to be marked checked.

Charles
06-02-2003, 06:45 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Example</title>
<style type="text/css">
<!--
label{display:block}
-->
</style>
<form action="">
<div>
<label><input type="checkbox">Fee</label>
<label><input type="checkbox">Fie</label>
<label><input type="checkbox">Foe</label>
<label><input type="checkbox">Fum</label>
</div>
<p>
<label><input type="checkbox" name=" all" onclick="for (j=0; j<4; j++) {this.form.elements[j].checked = this.checked}">Select All</label>
</p>
</form>