picture size

G

Glenn

Can someone tell me if there is a way to automatically have a (large)
picture adjust its size depending on how big someone's screen is?

For example, I have a web page that looks great when viewed on my desktop,
but when viewed on another computer the main graphic is too large, and
requires using both the bottom and side scroll bar.

I'd like to have the graphic size itself to the window it's being displayed
in.

Can someone tell if this is possible, and if so, point me to some directions
on how to do it?

Thanks
 
K

Kevin Spencer

You use JavaScript to detect the screen resolution, and set the width and/or
height of the image. The following is a simplified example:

<SCRIPT language="JavaScript">
<!--
if ((screen.width>=1024) && (screen.height>=768))
{
document.all("TheImage").width = 500;
document.all("TheImage").height = 300;
}
else
{
document.all("TheImage").width = 400;
document.all("TheImage").height = 200;
}
//-->
</SCRIPT>

<img srce="someimage.jpg" id="TheImage">

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Top