Kartais mum reikia sužinoti darbinio lango dydį bei plotį. Galima pačiam pasirašyti funkciją, tačiau ji gali veikti ne visose naršyklėse. Šios dvi funkcijos veikė ant mano išbandytų naršyklių (IE6,IE7,opera,firefox,maxthon):

  1. function getWindowHeight() {
  2.         var iwindowHeight = 0;
  3.         if (typeof(window.innerHeight) == ‘number’) {
  4.                 iwindowHeight = window.innerHeight;
  5.         }
  6.         else {
  7.                 if (document.documentElement && document.documentElement.clientHeight) {
  8.                         iwindowHeight = document.documentElement.clientHeight;
  9.                 }
  10.                 else {
  11.                         if (document.body && document.body.clientHeight) {
  12.                                 iwindowHeight = document.body.clientHeight;
  13.                         }
  14.                 }
  15.         }
  16.         return iwindowHeight;
  17. }
  18. function getWindowWidth() {
  19.         var iWindowWidth = 0;
  20.         if (typeof(window.innerWidth) == ‘number’) {
  21.                 iwindowWidth = window.innerWidth;
  22.         }
  23.         else {
  24.                 if (document.documentElement && document.documentElement.clientWidth) {
  25.                         iwindowWidth = document.documentElement.clientWidth;
  26.                 }
  27.                 else {
  28.                         if (document.body && document.body.clientWidth) {
  29.                                 iwindowWidth = document.body.clientWidth;
  30.                         }
  31.                 }
  32.         }
  33.         return iwindowWidth;
  34. }