PDA

View Full Version : Help with Conditional page loading


Micario
04-29-2005, 11:20 PM
Using the following code doesn't work:

<script>

if (navigator.appName == "Netscape" && (screen.width>= 800) && (screen.width <=1023)) {
document.write('<link rel="stylesheet" type="text/css" href="http://www.geocities.com/barriewadman@sbcglobal.net/ELLNE800.css" />');
}
if (navigator.appName == "Microsoft Internet Explorer" && (screen.width>= 800) && (screen.width <=1023)) {
document.write('<link rel="stylesheet" type="text/css" href="http://www.geocities.com/barriewadman@sbcglobal.net/ELLIE800.css" />');
}
if (navigator.appName == "Netscape" && (screen.width>= 1024) && (screen.width <=1151)) {
document.write('<link rel="stylesheet" type="text/css" href="http://www.geocities.com/barriewadman@sbcglobal.net/ELLNE1024.css" />');
}
if (navigator.appName == "Microsoft Internet Explorer" && (screen.width>= 1024) && (screen.width <=1151)) {
document.write('<link rel="stylesheet" type="text/css" href="http://www.geocities.com/barriewadman@sbcglobal.net/ELLIE1024.css" />');
}
if (navigator.appName == "Netscape" && (screen.width>= 1152) && (screen.width <=1279)) {
document.write('<link rel="stylesheet" type="text/css" href="http://www.geocities.com/barriewadman@sbcglobal.net/ELLNE1152.css" />');
}
if (navigator.appName == "Microsoft Internet Explorer" && (screen.width>= 1152) && (screen.width <=1279)) {
document.write('<link rel="stylesheet" type="text/css" href="http://www.geocities.com/barriewadman@sbcglobal.net/ELLIE1152.css" />');
}
if (navigator.appName == "Netscape" && (screen.width>= 1280) && (screen.width <=1599)) {
document.write('<link rel="stylesheet" type="text/css" href="http://www.geocities.com/barriewadman@sbcglobal.net/ELLNE1280.css" />');
}
if (navigator.appName == "Microsoft Internet Explorer" && (screen.width>= 1280) && (screen.width <=1599)) {
document.write('<link rel="stylesheet" type="text/css" href="http://www.geocities.com/barriewadman@sbcglobal.net/ELLIE1280.css" />');
}
if (navigator.appName == "Netscape" && screen.width== 1600) {
document.write('<link rel="stylesheet" type="text/css" href="http://www.geocities.com/barriewadman@sbcglobal.net/ELLNE1600.css" />');
if (navigator.appName == "Microsoft Internet Explorer" && screen.width== 1600) {
document.write('<link rel="stylesheet" type="text/css" href="http://www.geocities.com/barriewadman@sbcglobal.net/ELLIE1600.css" />');
}
</script>

What am I doing wrong - thanks

_Aerospace_Eng_
04-29-2005, 11:23 PM
You are missing a closing } here
if (navigator.appName == "Netscape" && screen.width== 1600) {
document.write('<link rel="stylesheet" type="text/css" href="http://www.geocities.com/barriewadman@sbcglobal.net/ELLNE1600.css" />');
}
if (navigator.appName == "Microsoft Internet Explorer" && screen.width== 1600) {
document.write('<link rel="stylesheet" type="text/css" href="http://www.geocities.com/barriewadman@sbcglobal.net/ELLIE1600.css" />');
}

Micario
04-30-2005, 05:50 PM
That did it - dumb move not catching the bracket,
and actually as you can see it's not redirect, it's actually loading a style sheet

Thanks for your help - Micario