Thanks for the great effort.
 
But I think I wait until Mozilla 0.99
that they implement document.body.clientHeight
in the same way (or improved) like MSIE
 
I think the idea of web standards with one code,
all browsers is something great for developers.
 

--
Roland M�sl
http://pege.org Clear targets for a confused civilization
http://BeingFound.com Web Design starts at the search engine
"Vadim Plessky" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Friday 30 November 2001 09:57, Ian Davey wrote:
|   Roland M�sl wrote:
|   > "Erik Arvidsson" <[EMAIL PROTECTED]> wrote in message
|   >>For Mozilla you are best of using window.innerWidth and
|   >
|   > window.innerHeight.
|   >
|   > This works only at Mozilla and gives at MSIE 6 an "undefined"
|
|   Then do something like:
|
|   if (window.innerHeight) {
|       windowHeight=window.innerHeight;
|   } else if (document.body.clientHeight) {
|       windowHeight=document.body.clientHeight;
|   } else {
|       /* panic... */
|   }

ok, I already know that Roland likes *short* code, so let me try pleeaase!..
:-)

// detect IE family, works nice for IE4.x, 5.x, 6.x
ie4up=(document.all)?true:false;
dom=(document.getElementById)?true:false;
// you can replace 'true' with 1 and 'false' with '0' to save 6 bytes from JS

// your code
// sh=screen.availHeight;
// sw=screen.availWidth;
// ch=document.body.clientHeight;
// cw=document.body.clientWidth;
// if(!cw){ch=sh-132;cw=sw-8}

// shortcuts to 'screen' and 'window' to save at least 10 bytes.
 s=screen; w=window;
sh=(ie4up)?s.availHeight:w.innerHeight;
sw=(ie4up)?s.availWidth:w.innerWidth;
// other shortcuts
 db=document.body;
 dv=document.defaultView; de=document.documentElement;
ch=(ie4up)?db.clientHeight:dv.getComputedStyle(de,"").getPropertyValue("height")
cw=(ie4up)?db.clientWidth:dv.getComputedStyle(de,"").getPropertyValue("width")

// print out results
document.write("<br>available width= "+sw);
document.write("<br>available height= "+sh);

document.write("<br>'client' width= "+cw);
document.write("<br>'client' height= "+ch);

 if(!cw){ch=sh-132;cw=sw-8}

P.S. I attach ready testcase to this mail, it returns:
available width= 760
available height= 514
'client' width= 760px
'client' height= 514px

in my Galeon/Mozilla 0.9.5
(need some extra time to reboot to Windows and test with MS IE, though)

Reply via email to