Révision 63c058e7
Ajouté par Renato Botelho il y a plus de 9 ans
usr/local/www/javascript/row_toggle.js | ||
---|---|---|
1 |
function fr_toggle(id) { |
|
2 |
var checkbox = document.getElementById('frc' + id); |
|
1 |
function fr_toggle(id, prefix) { |
|
2 |
if (!prefix) |
|
3 |
prefix = 'fr'; |
|
4 |
|
|
5 |
var checkbox = document.getElementById(prefix + 'c' + id); |
|
3 | 6 |
checkbox.checked = !checkbox.checked; |
4 |
fr_bgcolor(id); |
|
7 |
fr_bgcolor(id, prefix);
|
|
5 | 8 |
} |
6 |
function fr_bgcolor(id) { |
|
7 |
var row = document.getElementById('fr' + id); |
|
8 |
var checkbox = document.getElementById('frc' + id); |
|
9 |
|
|
10 |
function fr_bgcolor(id, prefix) { |
|
11 |
if (!prefix) |
|
12 |
prefix = 'fr'; |
|
13 |
|
|
14 |
var row = document.getElementById(prefix + id); |
|
15 |
var checkbox = document.getElementById(prefix + 'c' + id); |
|
9 | 16 |
var cells = row.getElementsByTagName('td'); |
10 | 17 |
var cellcnt = cells.length; |
11 | 18 |
|
12 | 19 |
for (i = 0; i < cellcnt; i++) { |
13 | 20 |
// Check for cells with frd id only |
14 |
if (cells[i].id == "frd" + id)
|
|
21 |
if (cells[i].id == prefix + 'd' + id)
|
|
15 | 22 |
cells[i].style.backgroundColor = checkbox.checked ? "#FFFFBB" : "#FFFFFF"; |
16 | 23 |
} |
17 | 24 |
//cells[7].style.backgroundColor = checkbox.checked ? "#FFFFBB" : "#990000"; |
18 | 25 |
} |
19 |
function fr_insline(id, on) { |
|
20 |
var row = document.getElementById('fr' + id); |
|
21 |
var prevrow; |
|
26 |
|
|
27 |
function fr_insline(id, on, prefix) { |
|
28 |
if (!prefix) |
|
29 |
prefix = 'fr'; |
|
30 |
|
|
31 |
var row = document.getElementById(prefix + id); |
|
32 |
var prevrow; |
|
22 | 33 |
if (id != 0) { |
23 |
prevrow = document.getElementById('fr' + (id-1));
|
|
34 |
prevrow = document.getElementById(prefix + (id-1));
|
|
24 | 35 |
} else { |
25 |
prevrow = document.getElementById('frheader');
|
|
36 |
prevrow = document.getElementById(prefix + 'header');
|
|
26 | 37 |
} |
27 | 38 |
|
28 | 39 |
var cells = row.getElementsByTagName("td"); |
29 | 40 |
var prevcells = prevrow.getElementsByTagName("td"); |
30 | 41 |
|
31 | 42 |
for (i = 0; i <= prevcells.length - 1; i++) { |
32 |
if (prevcells[i].id == 'frd' + (id-1)) {
|
|
43 |
if (prevcells[i].id == prefix + 'd' + (id-1)) {
|
|
33 | 44 |
if (on) { |
34 | 45 |
prevcells[i].style.borderBottom = "3px solid #990000"; |
35 | 46 |
prevcells[i].style.paddingBottom = ((id != 0) ? 2 : 3) + "px"; |
... | ... | |
42 | 53 |
} |
43 | 54 |
|
44 | 55 |
for (i = 0; i <= cells.length - 1; i++) { |
45 |
if (cells[i].id == 'frd' + (id)) {
|
|
56 |
if (cells[i].id == prefix + 'd' + (id)) {
|
|
46 | 57 |
if (on) { |
47 | 58 |
cells[i].style.borderTop = "2px solid #990000"; |
48 | 59 |
cells[i].style.paddingTop = "2px"; |
Formats disponibles : Unified diff
Change functions from row_toggle.js to work with different field names, keeping the old behaviour as default. This is necessary to have more than one group of fields in the same page