Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Feedback: irt.org FAQ Knowledge Base Q1118

Feedback on:
irt.org FAQ Knowledge Base Q1118

Sent by michel on January 22, 2002 at 01:56:02: - feedback #3511

Comments:
Using names (name="chk_something") :

function checkAll(theChk) {
var f = theChk.form;
var chk = theChk.checked;
for (i=0;i<f.elements.length;i++) {
if (f.elements[i].name.indexOf('chk_') !=-1) {
f.elements[i].checked=chk;
}
}
}

using fixed part an a number (name="chk_1" to name="chk_10"):

numberOfChks = 10;
function checkAll(theChk) {
var f = theChk.form;
var chk = theChk.checked;
for (i=1;i<=numberOfChks;i++) {
f.elements["chk_"+i].checked=chk;
}
}

<input type="checkbox" name="allChecker" onClick="checkAll(this)">Select all



Sent by Robert Baker on March 28, 2002 at 07:49:20: - feedback #3732

Worth:
Very worth reading

Comments:
Excellent work throughout your site! For the Q1118 item, I learned that one can check for a checkbox name that 'begins with' or 'contains' a recognizable item such as 'chk.' My checkbox names are dynamic from a Cold Fusion page. Subsequently, this took care of an immediate need this morning.

By the way, have you written and published any books that can be bought from Amazon?

Thanks!





Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 21st December 2007. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.