marybailey
Programmer
I picked up this code from the SuperFly site a long time back. Its supposed to "genericize" (I made this word up) DHTML using javascript to set variables to be used by either Netscape or IE. The layers are <div> definitions. It works for IE but it doesnt work for Netscape. Netscape just ignores it. Can someone tell me why? Also, is there a way to fix this so it does work?
Thanks,
Mrs B
function init(){
if (navigator.appName == "Netscape" {
layerRef="document.layers";
styleSwitch="";
visibleVar="show";
}else{
layerRef="document.all"; styleSwitch=".style"; visibleVar="visible";
}
}
function showLayer(layerName){
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="'+visibleVar+'"');
}
function hideLayer(layerName){
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
}
Thanks,
Mrs B
function init(){
if (navigator.appName == "Netscape" {
layerRef="document.layers";
styleSwitch="";
visibleVar="show";
}else{
layerRef="document.all"; styleSwitch=".style"; visibleVar="visible";
}
}
function showLayer(layerName){
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="'+visibleVar+'"');
}
function hideLayer(layerName){
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
}