J
Joseph
The idea is to show only one of the <Baby_Div> while hiding all the others.
At the moment all I have managed to do is to show each <Baby_Div> in turn as
expected, but the problem is that once a <Baby_Div>.innerHTML is replaced by one of the
procedures, it does not work anymore, ie, the <Baby_Div> content is not
displayed anymore, once code replaces the actual 'Blah' string.
Structure:
<Top-Div>
<Child_Div (6 in total)>
<Baby_Span>
<Baby_Span>
<Baby_Div>
<Child_Div...>
Any Idea?
Thanks in advance
<Top-Div id='idOutput'> contains 6 Child_Divs in each containing one<Baby_Div>:
The spans are fine, its the Baby_Divs I want to show/hide.
<DIV id='idOutput'>
<DIV id="idDivConfig" onclick="Hide_Divs('idOutput','idDivConfigChild','Child')">
<span id="IMGidDivConfig" style="display:inline;" class="PlusMinus">+ </span>
<span style="display:inline;" id=1> IP Config Results: </span>
<div class="Child" id="idDivConfigChild">blah </DIV> </DIV>
<DIV id="idDivPing" onclick="Hide_Divs('idOutput','idDivPingChild','Child')">
<span id="IMGidDivPing" style="display:inline;" class="PlusMinus">+ </span>
<span style="display:inline;" id=2> Ping Results: </span>
<div class="Child" id="idDivPingChild">blah </DIV> </DIV>
<DIV ...(4 more)
function Hide_Divs(theDiv,TheDivToShow,TheClass) {
var elDiv = getElementWithId(theDiv);
for (var x = 0; elDiv.childNodes[x]; x++) {
if (elDiv.childNodes[x].id.length > 0) {
var elChildElement = elDiv.getElementsByTagName("div");
var i = elChildElement.length;
var cReg = new RegExp('\\b' + TheClass + '\\b');
while (i--) {
var el = elChildElement;
if ( el.className && cReg.test(el.className)) {
if (el.id && el.id != TheDivToShow ){
el.style.display = 'none';
} else {
el.style.display = '';
}
}
}
}
}
}
Joseph
philippeoget at hotmail dot com
http://www.geocities.com/philippeoget/a2z/
At the moment all I have managed to do is to show each <Baby_Div> in turn as
expected, but the problem is that once a <Baby_Div>.innerHTML is replaced by one of the
procedures, it does not work anymore, ie, the <Baby_Div> content is not
displayed anymore, once code replaces the actual 'Blah' string.
Structure:
<Top-Div>
<Child_Div (6 in total)>
<Baby_Span>
<Baby_Span>
<Baby_Div>
<Child_Div...>
Any Idea?
Thanks in advance
<Top-Div id='idOutput'> contains 6 Child_Divs in each containing one<Baby_Div>:
The spans are fine, its the Baby_Divs I want to show/hide.
<DIV id='idOutput'>
<DIV id="idDivConfig" onclick="Hide_Divs('idOutput','idDivConfigChild','Child')">
<span id="IMGidDivConfig" style="display:inline;" class="PlusMinus">+ </span>
<span style="display:inline;" id=1> IP Config Results: </span>
<div class="Child" id="idDivConfigChild">blah </DIV> </DIV>
<DIV id="idDivPing" onclick="Hide_Divs('idOutput','idDivPingChild','Child')">
<span id="IMGidDivPing" style="display:inline;" class="PlusMinus">+ </span>
<span style="display:inline;" id=2> Ping Results: </span>
<div class="Child" id="idDivPingChild">blah </DIV> </DIV>
<DIV ...(4 more)
function Hide_Divs(theDiv,TheDivToShow,TheClass) {
var elDiv = getElementWithId(theDiv);
for (var x = 0; elDiv.childNodes[x]; x++) {
if (elDiv.childNodes[x].id.length > 0) {
var elChildElement = elDiv.getElementsByTagName("div");
var i = elChildElement.length;
var cReg = new RegExp('\\b' + TheClass + '\\b');
while (i--) {
var el = elChildElement;
if ( el.className && cReg.test(el.className)) {
if (el.id && el.id != TheDivToShow ){
el.style.display = 'none';
} else {
el.style.display = '';
}
}
}
}
}
}
Joseph
philippeoget at hotmail dot com
http://www.geocities.com/philippeoget/a2z/