Projet

Général

Profil

Télécharger (1,78 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / javascript / row_toggle.js @ 63c058e7

1
function fr_toggle(id, prefix) {
2
	if (!prefix)
3
		prefix = 'fr';
4

    
5
	var checkbox = document.getElementById(prefix + 'c' + id);
6
	checkbox.checked = !checkbox.checked;
7
	fr_bgcolor(id, prefix);
8
}
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);
16
	var cells = row.getElementsByTagName('td');
17
	var cellcnt = cells.length;
18

    
19
	for (i = 0; i < cellcnt; i++) {
20
		// Check for cells with frd id only
21
		if (cells[i].id == prefix + 'd' + id)
22
			cells[i].style.backgroundColor = checkbox.checked ? "#FFFFBB" : "#FFFFFF";
23
	}
24
	//cells[7].style.backgroundColor = checkbox.checked ? "#FFFFBB" : "#990000";
25
}
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;
33
	if (id != 0) {
34
		prevrow = document.getElementById(prefix + (id-1));
35
	} else {
36
		prevrow = document.getElementById(prefix + 'header');
37
	}
38

    
39
	var cells = row.getElementsByTagName("td"); 
40
	var prevcells = prevrow.getElementsByTagName("td");
41
	
42
	for (i = 0; i <= prevcells.length - 1; i++) {
43
		if (prevcells[i].id == prefix + 'd' + (id-1)) {
44
			if (on) {
45
				prevcells[i].style.borderBottom = "3px solid #990000";
46
				prevcells[i].style.paddingBottom = ((id != 0) ? 2 : 3) + "px";
47
			} else {
48
				prevcells[i].style.borderBottom = "1px solid #999999";
49
				prevcells[i].style.borderBottomWidth = "1px";
50
				prevcells[i].style.paddingBottom = ((id != 0) ? 4 : 5) + "px";
51
			}
52
		}
53
	}
54

    
55
	for (i = 0; i <= cells.length - 1; i++) {
56
		if (cells[i].id == prefix + 'd' + (id)) {
57
			if (on) {
58
				cells[i].style.borderTop = "2px solid #990000";
59
				cells[i].style.paddingTop = "2px";
60
			} else {
61
				cells[i].style.borderTopWidth = 0;
62
				cells[i].style.paddingTop = "4px";
63
			}
64
		}
65
	}
66
}
(13-13/16)