Click to See Complete Forum and Search --> : what's wrong with my code?? plz help


tsongwei
06-10-2003, 05:42 PM
I can't fiture out what's wrong with my code.
I wrote something like this:

if (document.layers){
alert("NN");
}else if(document.getElementById){
alert("IE");
}else{
alert("others");
}


It works with IE, but not for Netscape, does anyone know what's wrong in my code?

thx

pyro
06-10-2003, 05:50 PM
document.getElementById works fine in newer versions of NN

tsongwei
06-10-2003, 06:25 PM
Thanks

But what's best way to tell if the browser is IE or NN?

brendandonhue
06-10-2003, 06:37 PM
whats wrong with
alert(navigator.appName)
?

tsongwei
06-10-2003, 06:45 PM
But what is wrong with my code?

so if the browser is NN, do I get certain object by calling:
obj = document.layers("objName");
obj.value...........

Is this cool?