...

View Full Version : Load a different script based on screen resolution



CyberScout
06-24-2004, 09:04 PM
Ok, I have this area inside a resizable website that I would like to store large rotating images. Everytime a user enters the site, the script will load a different image. That is a script I have, but not one I can change with what I really want to do. Here is what I REALLY want to do.

If the user is a 1,600 x 1,200 resolution, I would like the script to call up different LARGER images all set to 100% size. If the user is using a 640 x 480 resolution, I would like to load smaller images also with 100% size. The idea is to have the image stretch with the page and still look correct. You can kinda see what I am trying to do here.

http://www1.hfs.psu.edu/obs/default.shtml

Let me know what you think

Thanks in advance!

Woundworth

Mr J
06-25-2004, 02:52 PM
Here's the basics

<script language="javascript">
<!--
function chk_res(){
w=screen.width

if(w==1600){
document.images["img1"].src="pic01.jpg"
}

if(w==640){
document.images["img1"].src="pic02.jpg"
}

}
// -->
</script>
</HEAD>

<BODY onload="chk_res()">

<img name="img1" src="" style="width:100%;height:200px">



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum