dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Web
Expertise: Intermediate
Jun 20, 2000

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Setting/Resetting Checkboxes with a Single Click

I have a bunch of files on the server that I wanted to be able to select, for example, to delete them or to give them special treatment. Thus, I made a table with their names and a checkbox for each of them. However, I also want to be able to select/deselect _all_ of them with a single click. To do this, I use Javascript.

 
<SCRIPT>
<!--
function SetCheckboxes(value) {
    nb = document.all.item('check').length;
    for(i=0; i<nb; i++) {
        document.all.item('check', i).checked=value;
    }
}
-->
</SCRIPT>

...

<FORM  NAME="ListFiles" METHOD=POST
ACTION='http://www.paisvasco.com/heraldica2/private/borrar.cgi'>
<TABLE border=2 align='center' width='100%'>
<TR><TD><input type='checkbox' id='check' 
name='it_1'></TD><TD>Item
1</TD></TR>
<TR><TD><input type='checkbox' id='check' 
name='it_2'></TD><TD7gt;Item
2</TD></TR>
7lt;TR7gt;<TD align='center' colspan='2'>
    <INPUT type='button' value='Select All'
onclick='SetCheckboxes(true);'>
Olivier Georg
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date