Java coding help please

Clinton Lowery clintonhlowery at yahoo.com
Sun Apr 3 16:30:10 EDT 2005


Hi.
 
I'm having a coding problem when trying to resize a window for IE 
6.0.

What I'm trying to do is pull different style sheets for different 
screen sizes. Instead of relying on percentages, which gets me close 
but no cigar, I'm trying to pull, for example, an 800 width or a 1024 
width depending on the window size. Since Firefox and IE have different 
measures, I have to test for the value self.innerWidth to see which is 
needed.


I'm not sure if my browser is the problem - it may be - as I get "undefined" as a value for frameWidth for the browser I use at work.


The function works for Firefox. It does not work for IE at 1024 
resolution however, and I've only found the three measurements to check 
by. Can anyone help?

Thanks.

Here's the operation:

var frameWidth;

if (self.innerWidth)
{ frameWidth = self.innerWidth; }
else if (document.documentElement && 
document.documentElement.clientWidth)
{ frameWidth = document.documentElement.clientWidth; }
else if (document.body)
{ frameWidth = document.body.clientWidth; }

if ( frameWidth > 800 )
{ if ( self.innerWidth )
    { document.write('<'+'link rel="stylesheet" type="text/css" 
href="http://jpl.coj.net/resources/odr1024-test.css" />'); }
    else 
    { document.write('<'+'link rel="stylesheet" type="text/css" 
href="http://jpl.coj.net/resources/odr1024ie-test.css" />'); }
}

else 
{ if ( self.innerWidth )
    { document.write('<'+'link rel="stylesheet" type="text/css" 
href="http://jpl.coj.net/resources/odr800-test.css" />'); }
    else 
    { document.write('<'+'link rel="stylesheet" type="text/css" 
href="http://jpl.coj.net/resources/odr800ie-test.css" />'); }
}



		
---------------------------------
Do you Yahoo!?
 Better first dates. More second dates. Yahoo! Personals 


*********************************************************************
Due to deletion of content types excluded from this list by policy,
this multipart message was reduced to a single part, and from there
to a plain text message.
*********************************************************************



More information about the Web4lib mailing list