Rev | Author | Line No. | Line |
---|---|---|---|
4988 | kaklik | 1 | // Enforce only two compare boxes being checked at once. |
2 | function enforceOnlyTwoChecked(clickedCheckbox) { |
||
3 | count = 0; |
||
4 | first = null; |
||
5 | form = clickedCheckbox.form; |
||
6 | for (i = 0; i < form.elements.length; i++) { |
||
7 | if (form.elements[i].type == 'checkbox' && form.elements[i].checked) { |
||
8 | if (first == null && form.elements[i] != clickedCheckbox) { |
||
9 | first = form.elements[i]; |
||
10 | } |
||
11 | count += 1; |
||
12 | } |
||
13 | } |
||
14 | if (count > 2) { |
||
15 | first.checked = false; |
||
16 | count -= 1; |
||
17 | } |
||
18 | } |