-
Notifications
You must be signed in to change notification settings - Fork 0
/
testtable.php
89 lines (66 loc) · 1.72 KB
/
testtable.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<html>
<head>
<style>
.hidedetail {
visibility:hidden;
display:none;
}
.showdetail {
visibility:block;
display:inline;
}
.minus {
background-image:url('minus.gif');
}
.plus {
background-image:url('plus.gif');
}
</style>
<script type="text/javascript" src="http://testsrv01.local/yahoo-dom-event.js"></script>
<script type="text/javascript">
function showhide(e,ele) {
console.log(ele);
//YAHOO.util.Dom.setStyle(ele, 'display', 'none');
if (YAHOO.util.Dom.hasClass(ele.id+"_details", 'showdetail')) {
YAHOO.util.Dom.removeClass(ele.id+"_details", 'showdetail');
YAHOO.util.Dom.addClass(ele.id+"_details", 'hidedetail');
YAHOO.util.Dom.removeClass(ele.id, 'minus');
YAHOO.util.Dom.addClass(ele.id, 'plus');
} else {
YAHOO.util.Dom.removeClass(ele.id+"_details", 'hidedetail');
YAHOO.util.Dom.addClass(ele.id+"_details", 'showdetail');
YAHOO.util.Dom.removeClass(ele.id, 'plus');
YAHOO.util.Dom.addClass(ele.id, 'minus');
}
element = YAHOO.util.Dom.get(ele.id+"_details");
console.log(element);
}
YAHOO.util.Event.onDOMReady(function(){
cbuttons = YAHOO.util.Dom.getElementsByClassName('changebutton');
for(i=0;i <cbuttons.length;i++) {
console.log(cbuttons[i].id);
YAHOO.util.Event.on(cbuttons[i], 'click', showhide,cbuttons[i]);
YAHOO.util.Dom.addClass(cbuttons[i].id+"_details", 'hidedetail');
}
});
</script>
</head>
<body>
<table>
<tr>
<td><a href="#" class="changebutton" id="changerow1">changer text</a></td>
<td></td>
</tr>
<tr id="changerow1_details" >
<td colspan="2">Hide show text</td>
</tr>
<tr>
<td><a href="#" class="changebutton" id="changerow2">changer text</a></td>
<td></td>
</tr>
<tr id="changerow2_details" >
<td colspan="2">Hide show text</td>
</tr>
</table>
</body>
</html>