getContentAreaHeight() Method
In both the init() method and the onResize() method, you saw a call to
getContentAreaHeight(), and now we??™re confronted with the code of that method:
getContentAreaHeight = function() {
var myHeight = 0;
if (typeof(window.innerHeight) == "number") {
// Non-IE
myHeight = window.innerHeight;
} else if (document.documentElement &&
document.documentElement.clientHeight) {
// IE 6+ in "standards compliant mode".
myHeight = document.documentElement.clientHeight;
CHAPTER 6 n REMOTELY MANAGING YOUR FILES: DWR FILE MANAGER 296
} else if (document.body && document.body.clientHeight) {
// IE 4 compatible.
myHeight = document.body.clientHeight;
}
return myHeight;
} // End getContentAreaHeight().
In short, this method deals with all the cross-browser issues and at the end gets a pretty
accurate number that represents the pixel height of the content area of the browser, that is,
the size of the area the document is displayed in. Because various browsers provide this information
via differing properties of the window and/or document object, and worse still, IE gives
different values depending on whether the document is in quirks mode or standards-compliant
(a.
Pages:
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532