...

View Full Version : simple modification



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

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?

Regards

Kor
10-20-2006, 03: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.

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


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

Kor
10-20-2006, 05: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?

urgido
10-20-2006, 06: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 :)

urgido
10-21-2006, 02:54 AM
Solved

jmrker
10-21-2006, 08: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