This chapter is from the book
Getting the Screen Size
An important feature of JavaScript these days is the ability to get the screen size. The screen sizes of browsers vary so much that you often need to use different sets of code for larger, medium, or smaller screens. To get the screen size, use the screen.availHeight and screen.availWidth attributes. These values are specified in the number of pixels.