Css file per res problem

Associate
Joined
28 Sep 2004
Posts
135
Location
Gibraltar
Hi guys,

as per title im having a small problem hope theres a simple solution.

Basically im using the following code within my index page of my site to detect the resolution of the screen and redirect to a css file. It works perfectly in Firefox but i cant get it to work in Internet Explorer.

var winW = 0, winH = 0;

if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape") {
winW = window.innerWidth-16;
winH = window.innerHeight-16;
}
if (navigator.appName.indexOf("Microsoft")!=-1) {
winW = document.body.offsetWidth;
winH = document.body.offsetHeight;
}
}
if (winW <= 1680) {
document.write('<link rel="stylesheet" type="text/css" href="style1680.css">');
}
if (winW <= 1600) {
document.write('<link rel="stylesheet" type="text/css" href="style.css">');
}
if (winW <= 1280) {
document.write('<link rel="stylesheet" type="text/css" href="style.css">');
}
if (winW <= 1024) {
document.write('<link rel="stylesheet" type="text/css" href="style1024.css">');
}
if (winW <= 800) {
document.write('<link rel="stylesheet" type="text/css" href="style800.css">');
}
if (winW <= 640) {
document.write('<link rel="stylesheet" type="text/css" href="style800.css">');
}


can any1 see why this wouldnt work in Internet explorer? on following site :

http://firefly.rar.gi
 
yea theres lots of things i need to change.....
and about the % thing i tried that but it really was a lot more work that i thought, I cant set the banner for example as a percentage as it will stretch etc.

So i would much rather stick to style sheets :/ just need to know how to make it work in internet explorer.
 
i just done like the website not to take up the whole screen..it looks...a little untidy, so i have done it manually so that it fits the screen exactly :/

ive tried percentages and i just couldnt get past the images, coloured backgrounds are obviously not a problem, but i just couldnt get the images to work out with percentages.

I just need to know please :/ whats wrong with the coding to make it work in IE. I do appreciate your advice but this is how I've decided to do it :/

any1 got any ideaS?
 
ok ill make sure there are style sheets appropriate for each rez...
but eem...well i still ned my question answering :/

does any 1 know?
 
Back
Top Bottom