netscape problem mit abfragen und zuweisungen
peri
- javascript
0 peri
Ich habe an meiner abfrage gebastelt. Der ie nimmt sie an, der ns ( alle versionen) sträunben sich dagegen. ich weiss nicht weshalb.
kann bitte jemand über den code schaun?
var system= (navigator.appVersion.indexOf("Mac")==-1)?"PC":"MAC";
var browser=(navigator.appName.indexOf("Microsoft")==-1)?"NS":"IE";
var systembrowser=system+ browser;
var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ns7=document.getElementById&&!document.all
var skinpath='skin/{skinname}/';
alert (systembrowser);
switch (systembrowser)
{
case "PCIE":
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ie_pc.css'>");
break;
case "PCNS":
// Browserbedingt umleiten
if (ns4){
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ns_pc.css'>");
}
if (ns6){
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ns6_pc.css'>");
}
if (ns7){
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ns7_pc.css'>");
}
break;
case "MACIE":
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ie_mac.css'>");
break;
case "MACNS":
if (ns4){
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ns_mac.css'>");
}
if (ns6){
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ns6_mac.css'>");
}
if (ns7){
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ns7_mac.css'>");
}
break;
default:
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ie_pc.css'>");
break;
}
____________________________________________________________
ich habs:
bitte schön:::::
var system= (navigator.appVersion.indexOf("Mac")==-1)?"PC":"MAC";
var browser=(navigator.appName.indexOf("Microsoft")==-1)?"NS":"IE";
var systembrowser=system+ browser;
var skinpath='skin/{skinname}/';
switch (systembrowser)
{
case "PCIE":
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ie_pc.css'>");
break;
case "PCNS":
if(navigator.appVersion.substring(0,1) <="4")
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ns_pc.css'>");
else
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ns6_pc.css'>");
break;
case "MACIE":
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ie_mac.css'>");
break;
case "MACNS":
if(navigator.appVersion.substring(0,1) <="4")
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ns_mac.css'>");
else
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ns6_mac.css'>");
break;
default:
document.write("<link rel=stylesheet type='text/css' href='"+skinpath+"ie_pc.css'>");
break;
}