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)
|
| ian.
--
Vadim Plessky
http://kde2.newmail.ru (English)
33 Window Decorations and 6 Widget Styles for KDE
http://kde2.newmail.ru/kde_themes.html
KDE mini-Themes
http://kde2.newmail.ru/themes/