View Full Version : simple modification

10-20-2006, 10:09 AM
function checkall(formname,checkname,thestate){
var el_collection=eval("document.forms."+formname+"."+checkname)
for (c=0;c<el_collection.length;c++)

this code checkall radio buttons or checkbox by "name" attribute but I want to that code works by ID attribute. Can somebody make a modification for this?


10-20-2006, 02:02 PM
unlike the name attribute, the id must be unique on page/session. So that you may not have a group of radio buttons with the same id.

10-20-2006, 04:43 PM
This does not work, only works with the tag name

Source: http://javascriptkit.com/script/script2/checkall.shtml

10-20-2006, 04:52 PM
I don't understand what you say. Once again, id must be unique.

What do you want, in fact. What that code should do? can u detail?

10-20-2006, 05:00 PM
Description: A good addition to your forms if they contain a multitude of check/radio buttons is a "check/uncheck all" feature. This script does just that for any group of checkboxes and radio buttons. Useful!

IMPLEMENTATION: The first parameter should contain the name of your form, the second the common name of checkboxes you're grouping together, and lastly, whether they should be checked or unchecked (pass true for former).

FOR MORE DETAILS: http://javascriptkit.com/script/script2/checkall.shtml

Regards :)

10-21-2006, 01:54 AM

10-21-2006, 07:59 PM
And your solution is?
If it is so useful, why not share it?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum