From f82a7df92b8046a27803d96e4b4ff5272efefe33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Mon, 25 Mar 2002 20:45:17 +0000 Subject: [PATCH] Merged patch #534660 - Check All / Uncheck All --- ChangeLog | 3 +++ libraries/functions.js | 14 ++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9e18ea5a..d7635b517 100755 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,9 @@ $Source$ lang/russian-win1251.inc.php3: updated thanks to Alvar Soome , Sandis Jērics and Artyom Rabzonov . + * db_details.php3, line 386: fixed a js error. + * libraries/functions.js, lines 412-422: merged patch + #534660 - Check All / Uncheck All, thanks to "Leblanc". 2002-03-24 Loļc Chapeaux * user_details.php3, line 1191: fixed bug #534159 - Can't change user diff --git a/libraries/functions.js b/libraries/functions.js index cace77739..018eb507a 100644 --- a/libraries/functions.js +++ b/libraries/functions.js @@ -409,11 +409,17 @@ function setPointer(theRow, theAction, theDefaultColor, thePointerColor, theMark function setCheckboxes(the_form, do_check) { var elts = document.forms[the_form].elements['selected_tbl[]']; - var elts_cnt = elts.length; + var elts_cnt = (typeof(elts.length) != 'undefined') + ? elts.length + : 0; - for (var i = 0; i < elts_cnt; i++) { - elts[i].checked = do_check; - } // end for + if (elts_cnt) { + for (var i = 0; i < elts_cnt; i++) { + elts[i].checked = do_check; + } // end for + } else { + elts.checked = do_check; + } // end if... else return true; } // end of the 'setCheckboxes()' function