8

I am trying to get access to the height of the entire page (including scrolling). In chrome, document.body.scrollHeight does this. In firefox, this doesn't work... what is the equivalent in firefox?

deruse
  • 2,851
  • 7
  • 40
  • 60

3 Answers3

1

definitely start using jquery, accessing $(document).height() will do all the browser checks for you.

http://api.jquery.com/height/

sonjz
  • 4,870
  • 3
  • 42
  • 60
1

You can use jquery to do this without browser problem.

User jQuery $(document).height() and $(document).scrollTop() functions

FURKAN ILGIN
  • 2,290
  • 3
  • 18
  • 21
1
<script type="text/javascript">
var scnWid,scnHei;
if (self.innerHeight) // all except Explorer
{
scnWid = self.innerWidth;
scnHei = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)
// Explorer 6 Strict Mode
{
scnWid = document.documentElement.clientWidth;
scnHei = document.documentElement.clientHeight;
}
else if (document.body) // other Explorers
{
scnWid = document.body.clientWidth;
scnHei = document.body.clientHeight;
} 

</script>
Travis J
  • 81,153
  • 41
  • 202
  • 273