Soldier Bob
07-08-2002, 08:00 PM
I am trying to get this to work on MS IE 5.00.xxxx
It should take in a layer, make it invisible or visible.
function toggle_layer_visibility( layer_to_change ) {
if ((layer_to_change != null) && (layer_to_change != "")) {
if (document.layers) {
alert("Debug: netscape");
if (document.layers[layer_to_change].visibility == 'visible' || document.layers[layer_to_change].visibility == 'show') {
alert("Debug: layer is currently shown. Attempting to hide:");
document.layers[layer_to_change].visibility = 'hidden';
} else if (document.layers[layer_to_change].visibility == 'hidden' || document.layers[layer_to_change].visibility == 'hide') {
alert("Debug: layer is currently hidden. Attempting to show:");
document.layers[layer_to_change].visibility = 'visible';
} else {
}
} else if (document.all) {
alert("Debug: IE");
if (document.all[layer_to_change].style) {
alert("Debug: a style attribute exists for the " + layer_to_change);
}
alert("Debug: It is: " + document.all[layer_to_change].style.visibility);
if (document.all[layer_to_change].style.visibility) {
alert("Debug: a visibility attribute exists for the " + layer_to_change + ". It is: " + document.all[layer_to_change].style.visibility);
}
if (document.all[layer_to_change].style.visibility == 'visible') {
alert("Debug: layer is currently shown. Attempting to hide:");
document.all[layer_to_change].style.visibility = 'hidden';
} else if (document.all[layer_to_change].style.visibility == 'hidden') {
alert("Debug: layer is currently hidden. Attempting to show:");
document.all[layer_to_change].style.visibility = 'visible';
//.style.visibility
}
}
if (document.getElementById) {
alert("Debug: " + document.getElementById(layer_to_change).style.visibility );
} else {
alert("Debug: getElementById does not exist.");
}
} else {
alert('Nothing was sent to the layer_toggle_visibility function');
}
}
It should take in a layer, make it invisible or visible.
function toggle_layer_visibility( layer_to_change ) {
if ((layer_to_change != null) && (layer_to_change != "")) {
if (document.layers) {
alert("Debug: netscape");
if (document.layers[layer_to_change].visibility == 'visible' || document.layers[layer_to_change].visibility == 'show') {
alert("Debug: layer is currently shown. Attempting to hide:");
document.layers[layer_to_change].visibility = 'hidden';
} else if (document.layers[layer_to_change].visibility == 'hidden' || document.layers[layer_to_change].visibility == 'hide') {
alert("Debug: layer is currently hidden. Attempting to show:");
document.layers[layer_to_change].visibility = 'visible';
} else {
}
} else if (document.all) {
alert("Debug: IE");
if (document.all[layer_to_change].style) {
alert("Debug: a style attribute exists for the " + layer_to_change);
}
alert("Debug: It is: " + document.all[layer_to_change].style.visibility);
if (document.all[layer_to_change].style.visibility) {
alert("Debug: a visibility attribute exists for the " + layer_to_change + ". It is: " + document.all[layer_to_change].style.visibility);
}
if (document.all[layer_to_change].style.visibility == 'visible') {
alert("Debug: layer is currently shown. Attempting to hide:");
document.all[layer_to_change].style.visibility = 'hidden';
} else if (document.all[layer_to_change].style.visibility == 'hidden') {
alert("Debug: layer is currently hidden. Attempting to show:");
document.all[layer_to_change].style.visibility = 'visible';
//.style.visibility
}
}
if (document.getElementById) {
alert("Debug: " + document.getElementById(layer_to_change).style.visibility );
} else {
alert("Debug: getElementById does not exist.");
}
} else {
alert('Nothing was sent to the layer_toggle_visibility function');
}
}