Revision 376665623363 () - Diff

Link to this snippet: https://friendpaste.com/5aZA2XGwUieOrEBJuppYZD
Embed:
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
var boardMembs = ["boardMembersName", "boardMembersName", "boardMembersName"];

function setupItems() // initiates from <body onload="setupItems()">
{
for (var i=0; i< boardMembs.length; i++)
{
var currentID = document.getElementById(boardMembs[i]);
if (currentID.addEventListener) // does the browser understand this command
{
currentID.addEventListener('click', expansion, false); // if so, do this
}
else
{
currentID.attachEvent('onclick',expansionIE); // if not, do this
}
}
}
function expansion()
{
var curTitle = this.getAttribute("title");

var getHiddenElement = this.nextSibling.nextSibling;

if (curTitle == "inactive")
{
this.setAttribute("title", "active");
getHiddenElement.setAttribute("class", "boardMembBody active")
}
else
{
this.setAttribute("title", "inactive");
getHiddenElement.setAttribute("class", "boardMembBody inactive");
}
}
function expansionIE(e)
{
if (!e) // if not e, than set e
{
var e = windows.event;
}
if (!e.target) // if not e.target, than set e.target
{
e.target = e.srcElement;
}
var curTitle = e.srcElement.getAttribute("title"); // get title from html tag
var getHiddenElement = e.srcElement.nextSibling.getAttribute("className"); // get class name
if (getHiddenElement == "boardMembBody inactive") // does the class = "boardMembBody inactive"
{
e.srcElement.nextSibling.setAttribute("className", "boardMembBody active"); // if so change to active
}
else
{
e.srcElement.nextSibling.setAttribute("className", "boardMembBody inactive"); // if not than must be active, so change to inactive
}
}