show/hide virker ikke i Firefox
Hejsa, jeg sidder her med en menu som funker fint i IE, men jeg kan ikke få skidtet til at virke i Firefox.Det der sker er at menuen ikke "hider" til at starte med, så alle undermenuerne er synlige.
Dette er koden til det:
function GetChildElem(eSrc,sTagName)
{
var cKids = eSrc.children;
for (var i=0;i<cKids.length;i++)
{
if (sTagName == cKids[i].tagName) return cKids[i];
}
return false;
}
function expandCollapse(processStep){
/* hide all SPAN's */
// HideAll('SPAN');
// ExpandNode(document.getElementById(processStep).parentElement);
if (eChild = GetChildElem(document.getElementById(processStep),"SPAN")){
document.getElementById(processStep).parentElement.className = (document.getElementById(processStep).parentElement.className.indexOf("Highlight") > 0) ? document.getElementById(processStep).className.replace("Highlight","") : document.getElementById(processStep).className + "Highlight";
eChild.style.display = ("inline" == eChild.style.display ? "none" : "inline");
eChild.style.visibility = ("visible" == eChild.style.visibility ? "hidden" : "visible");
var childrenOfCurrentItem = document.getElementById(processStep).children;
for (var i=0; i < childrenOfCurrentItem.length; i++) {
if (childrenOfCurrentItem[i].tagName.toUpperCase() == 'TABLE') {
var childrenOfTable = childrenOfCurrentItem[i].children;
for (var j=0; j < childrenOfTable.length; j++){
if (childrenOfTable[j].tagName.toUpperCase() == 'TBODY') {
var childrenOfTbody = childrenOfTable[j].children;
for (var k=0; k < childrenOfTbody.length; k++){
if (childrenOfTbody[k].tagName.toUpperCase() == 'TR') {
var childrenOfTR = childrenOfTbody[k].children;
for (var l=0; l < childrenOfTR.length; l++){
if (childrenOfTR[l].tagName.toUpperCase() == 'TD') {
if (childrenOfTR[l].id == 'rightarrow') {
childrenOfTR[l].innerHTML = ("visible" == eChild.style.visibility ? "<img src='images/menu/menu_down.gif' border='0'/>" : "<img src='images/menu/menu_right.gif' border='0'/>");
}
}
}
}
}
}
}
}
}
}
}
function Highlight(processStep)
{
// alert(document.getElementById(processStep).className);
document.getElementById(processStep).className = (document.getElementById(processStep).className.indexOf("Highlight") > 0) ? document.getElementById(processStep).className.replace("Highlight","") : document.getElementById(processStep).className + "Highlight";
// alert(document.getElementById(processStep).className);
}
function ShowAll(sTagName)
{
var cElems = document.all.tags(sTagName);
var iNumElems = cElems.length;
for (var i=1;i<iNumElems;i++) {
cElems[i].style.display = "inline";
cElems[i].style.visibility = "visible";
}
}
function HideAll(sTagName)
{
var cElems = document.all.tags(sTagName);
var iNumElems = cElems.length;
for (var i=0;i<iNumElems;i++) {
if (cElems[i].className == 'clsHasKids') {
cElems[i].style.display = "none";
cElems[i].style.visibility = "hidden";
}
}
}
function HighlightProcessStep(processStep){
/* hide all SPAN's */
HideAll('SPAN');
/* change the class of the current menu item*/
if (document.getElementById(processStep)){
document.getElementById(processStep).className = 'menuCurrent';
/* expand the parent items of the current menu item */
ExpandNode(document.getElementById(processStep).parentElement);
/* highlighting arrow */
var childrenOfCurrentItem = document.getElementById(processStep).children;
for (var i=0; i < childrenOfCurrentItem.length; i++) {
if (childrenOfCurrentItem[i].tagName.toUpperCase() == 'TABLE') {
var childrenOfTable = childrenOfCurrentItem[i].children;
for (var j=0; j < childrenOfTable.length; j++){
if (childrenOfTable[j].tagName.toUpperCase() == 'TBODY') {
var childrenOfTbody = childrenOfTable[j].children;
for (var k=0; k < childrenOfTbody.length; k++){
if (childrenOfTbody[k].tagName.toUpperCase() == 'TR') {
var childrenOfTR = childrenOfTbody[k].children;
for (var l=0; l < childrenOfTR.length; l++){
if (childrenOfTR[l].tagName.toUpperCase() == 'TD') {
if (childrenOfTR[l].id == 'arrow') {
childrenOfTR[l].innerHTML = "<img src='images/arrow_purple.gif' border='0'/>";
}
}
}
}
}
}
}
}else if (childrenOfCurrentItem[i].tagName.toUpperCase() == 'SPAN') {
childrenOfCurrentItem[i].style.display = 'inline';
childrenOfCurrentItem[i].style.visibility = 'visible';
}
}
}
}
function ExpandNode(node){
/* stop the recursive function if UL tag with id='top' is found */
if ((node.parentElement.tagName.toUpperCase() == 'UL') && (node.parentElement.id == 'top')){
return;
}
else{
/* keep going up a level */
ExpandNode(node.parentElement);
/* if parent node is 'SPAN' then, expand it */
if (node.parentElement.tagName.toUpperCase() == 'SPAN') {
node.parentElement.style.display = 'inline';
node.parentElement.style.visibility = 'visible';
/* Highlight its parent TD */
node.parentElement.parentElement.className = node.parentElement.parentElement.className + 'Highlight';
var childrenOfCurrentItem = node.parentElement.parentElement.children;
for (var i=0; i < childrenOfCurrentItem.length; i++) {
if (childrenOfCurrentItem[i].tagName.toUpperCase() == 'TABLE') {
var childrenOfTable = childrenOfCurrentItem[i].children;
for (var j=0; j < childrenOfTable.length; j++){
if (childrenOfTable[j].tagName.toUpperCase() == 'TBODY') {
var childrenOfTbody = childrenOfTable[j].children;
for (var k=0; k < childrenOfTbody.length; k++){
if (childrenOfTbody[k].tagName.toUpperCase() == 'TR') {
var childrenOfTR = childrenOfTbody[k].children;
for (var l=0; l < childrenOfTR.length; l++){
if (childrenOfTR[l].tagName.toUpperCase() == 'TD') {
if (childrenOfTR[l].id == 'rightarrow') {
childrenOfTR[l].innerHTML = "<img src='images/menu/menu_down.gif' border='0'/>";
}
}
}
}
}
}
}
}
}
}
}
}