Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

BBS: Re: Background image - August 07, 1998 at 15:20:30

You are here: irt.org | BBS | Re: Background image [This BBS is closed]

Posted by Tim Drozinski on August 07, 1998 at 15:20:30:

In Reply to: Background image posted by Ed W on August 06, 1998 at 15:18:47:

: I have a page with one big background image. Is it possible to change the height and width of the background image with the height and width of the window so the page will always look right?

You can use the following script... modify as necessary (image
names, etc.). Of course, you must make sure the images are
sized right (I'm assuming widths of 640, 800 and 1024, you
may choose to specify your own), and some browsers will
still not display correctly, depending on whether or not the
browser window is maximized, whether taskbars are hidden
or displayed, etc. Also, I haven't fully tested it for version
compatibility.. I know it works with Netscape 4.05, and
that it doesn't work for IE3... If you can live with that, or
you can improve on it, feel free. If I can iron it all out, I'll
try to post the whole thing here as an article.

//put this part in your <HEAD>..</HEAD> block.
<SCRIPT LANGUAGE="JavaScript">

if (screen)
{
var docWidth = screen.width;

function pickBGImage ()
{
if (docWidth < 800) // if screen is 640x480...
document.write (' else if (docWidth >= 800 && docWidth < 1024) // if screen is 800x600...
document.write (' else // if screen is 1024x768 (or greater)...
document.write ('<BODY BACKGROUND="bg3.jpg">');
}
</SCRIPT>
.
.
.

// put this part in the body of your HTML
<SCRIPT Language="JavaScript">
pickBGImage ();
</SCRIPT>

Follow-ups:

You are here: irt.org | BBS | Re: Background image [This BBS is closed]

©2018 Martin Webb