Thursday 3 May 2012

How to get Screen bounds or dimensions in javascript


Generally our application may get opened in different types of monitors. For example in home pc's we used to prefer 15 (or) 17 inches monitor but in Companies and others they used to prefer big monitors in that case this code will be useful.
          While adjusting our application according to screen bounds and adjust our window according to screen we can set the height and width manually by getting the screen height and width like this

--------------------------------------------------
var Height = screen.height;
var Width = screen.width;
--------------------------------------------------

Here in this case whatever the height and width for the screen will be known in above mentioned height and width variables and according to that we can adjust our application manually.

0 comments:

Post a Comment