I am trying to get a script working that detects the users resolution and then changes the stylesheet to a optimized one (for 800x600, only res the style doesnt seem to work right on). I found this script: http://javascript.internet.com/user-...n-details.html and modified it a bit to change the stylesheet instead, but the result was that no matter what resolution I was on it always changed to teh alternate version.
So I messed around a bit and got this:
Code:
<!-- This script and many more are available free online at
-->
<!-- The JavaScript Source!! http://javascript.internet.com
-->
<!-- Begin
var screen_width = null;
var screen_height = null;
var resolution = null;
screen_width = screen.width;
screen_height = screen.height;
if (screen_width = "800" && screen_height = "600") {
document.write("<style
type='text/css'>@import'stylealt.css';</style>");
}
else {
}
// End -->
(got that after doing a bit of googleing)
anyways that doesnt work at all. On the original script it switched to the alternate style no matter what. With my modified version it never switches to the alternate, despite being on 800 x 600.
Any clues on where I can get a working script/how I can fix this one?
|