Click to See Complete Forum and Search --> : different .js file addition depending on a screen resolution


patriot
01-01-2003, 03:39 PM
i have a problem trying to load a .js file into my page depending on the screen resolution of a user. for example for a resolution of 800x600px i want small.js to be loaded, while for a resolution 1024x764px i want big.js to be loaded. how can i do that with a script? thx in advance!

khalidali63
01-01-2003, 11:48 PM
though you can do that as well,why won't you write the appropriate JavaScript code depending upon the Screen Res?

Khalid

AdamBrill
01-01-2003, 11:59 PM
Try this:


<script language=javascript>
if(screen.Width>800)
{
document.write("<script src='big.js' language=javascript><\/script>");
}
else
{
document.write("<script src='small.js' language=javascript><\/script>");
}
</script>


If their screen width is more than 800 it will use the big.js, and if it is 800 or less it will use the small.js