Hi!
function hideLayer() {
if (ns4) {document.layers[id].visibility = "hide"}
else {document.getElementById(id).style.visibility = "hidden"}
}function showLayer() {
if (ns4) {document.layers[id].visibility = "show"}
else {document.getElementById(id).style.visibility = "visible"}
}
Jau. Allerdings muss id ein String sein, sprich in der obigen Notation ist id eine Variable, die mit einem String gefüllt werden muss.
Du solltes ausserdem korrekterweise noch prüfen, ob getElementById wirklich unterstützt wird:
if(ns4){
// Code NN4
} else if( document.getElementById ){
// Code Rest
}
Und da weitaus mehr Browser getElementById beherrschen drehen wir das ganze um, und weil das spass macht können wir den IE 4 auch noch mal reinnehmen:
if( document.getElementById ){
// Code für NN6/7/Mozilla,Opera,Konqueror und einige andere moderne Browser
} else if( ns4 ){
// Code NN4
} else if( document.all ){
// Code IE4
document.all[id].style.visibility
}
Und ich hoffe mal das du den ns4 über die Existenz von document.layers prüfst und nicht über das navigator-Objekt.
Gruß Herbalizer
SELF-Code: (http://emmanuel.dammerer.at/selfcode.html)
sh:( fo:) ch:? rl:( br:> n4:& ie:% mo:} va:} de:] zu:) fl:{ ss:) ls:& js:|