Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Window Height


Message #1 by "Chris Thompson" <cthompson@n...> on Mon, 13 May 2002 13:57:33 -0600
Thanks a ton.  That did the trick.

Chris

-----Original Message-----
From: Sten Hougaard [mailto:STG@e...]
Sent: Tuesday, May 14, 2002 1:30 AM
To: JavaScript HowTo
Subject: [javascript_howto] Re: Window Height


Hi

Try to view this in your browser:

<body onload=3D"showOutput()">
<script language=3D"javascript">
function showOutput() {
  var o=3D '<table cellspacing=3D0>'+TR(TH('Property')+TH('Current
value')+TH
('MSDN Description'))
  o+=3DEval('document.body.clientHeight', 'Retrieves the height of the
object
including padding, but not including margin, border, or scroll bar. ');
  o+=3DEval('document.body.offsetHeight', 'Retrieves the height of the
object
relative to the layout or coordinate parent, as specified by the
offsetParent property.');
  o+=3DEval('document.body.scrollHeight', 'Retrieves the scrolling 
height
of
the object. ');
  o+=3DEval('document.body.scrollTop ', 'Sets or retrieves the distance
between the top of the object and the topmost portion of the content
currently visible in the window.');
  o+=3DEval('screen.availHeight', 'Retrieves the height of the working
area
of the systems screen, excluding the Microsoft(r) Windows(r) taskbar.');
  o+=3DEval('screen.height', 'Retrieves the vertical resolution of the
screen.')
  o+=3DEval('window.screenTop');
  output.innerHTML =3D o+'</table>';
}
function Eval(sVar, sTxt) {
  return (TR(TD(sVar)+TD(eval(sVar), 'center')+TD((sTxt) ? sTxt : '-')))
}
function TH(sTxt) { return ('<th align=3D"left" nowrap valign=3D"top" 
style
=3D"border-right: 1px solid black; border-bottom: 1px solid gray">'
+sTxt+'</th>')}
function TD(sTxt, sAlign) { return ('<td valign=3D"top" 
align=3D"'+((sAlign)
?
sAlign : 'left')+'"style=3D"border-right: 1px solid black; 
border-bottom:
1px
solid lightgray">'+sTxt+'</td>')}
function TR(sTxt) { return ('<tr>'+sTxt+'</tr>')}
</script>
<div id=3D"output">
</div>
<div align=3D"right"><input type=3D"button" onclick=3D"showOutput()" 
value
=3D"Update values"></div>

</body>

Perhaps one or more of the values can bring you closer to you goal! :-)

Cheers

Sten Hougaard
EDB Gruppen
Application developer/web-designer
e-business solutions





                    "Chris

                    Thompson"            To:     "JavaScript HowTo"
<javascript_howto@p...>               
                    <cthompson@n...       cc:

                    tah.com>             Subject:     [javascript_howto]
Window Height                            


                    13-05-2002

                    21:57

                    Please respond

                    to "JavaScript

                    HowTo"









How Do I get the window height?  Screen.height gives me the whole
screen, but I only want the window.

Thanks,

Chris Thompson


---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20





---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20

  Return to Index