screen object
Contains information about the dimensions of the screen and the display settings.
If you need the placement of the browser window on the screen, use the outerWidth, outerHeight and the screenX, screenY properties of the window object.
Syntax:
Properties that reference the object:
| window.screen |
The base interface, through which you can add new functionalities to the screen object, is the Screen interface.
Possible members:
Properties:
Returns the height of the area on the screen that is available for application windows. | ||||||||||||
Returns the left side of the area on the screen that is available for application windows. | ||||||||||||
Returns the top side of the area on the screen that is available for application windows. | ||||||||||||
Returns the width of the area on the screen that is available for application windows. | ||||||||||||
Sets or retrieves the number of bits used to represent the color of a single pixel in the off-screen bitmap buffer. | ||||||||||||
Retrieves the number of bits used to represent the color of a single pixel on the screen or in the buffer when off-screen buffering is allowed. | ||||||||||||
Returns the current number of dots per inch (DPI) of the document's viewport along the horizontal (x) axis. | ||||||||||||
Returns the current number of dots per inch (DPI) of the document's viewport along the vertical (y) axis. | ||||||||||||
Returns a Boolean value that indicates whether font smoothing is enabled. | ||||||||||||
Returns the vertical resolution of the display screen, in pixels. | ||||||||||||
Retrieves the horizontal offset of top-left corner of the current screen relative to the top-left corner of the main screen, in pixels. | ||||||||||||
Returns the number of dots per inch (DPI) of the document's viewport along the horizontal (x) axis at normal zoom level. | ||||||||||||
Returns the number of dots per inch (DPI) of the document's viewport along the vertical (y) axis at normal zoom level. | ||||||||||||
|
Retrieves the number of bits used to represent the color of a single pixel on the screen or in the buffer when off-screen buffering is allowed. | |||||||||||
|
Returns the number of dots per inch (DPI) of the display screen along the horizontal (x) axis at normal zoom level. | |||||||||||
|
Returns the number of dots per inch (DPI) of the display screen along the horizontal (x) axis at normal zoom level. | |||||||||||
Retrieves the vertical offset of the top-left corner of the current screen relative to the top-left corner of the main screen, in pixels. | ||||||||||||
Specifies or returns the time interval (in milliseconds) between screen updates. | ||||||||||||
Returns the horizontal resolution of the display screen, in pixels. |
Example HTML code 1:
This example illustrates the use of the screen object:
|
||||
<head> <script type="text/javascript"> function GetDimensions () { var scrLeft = document.getElementById ("scrLeft"); scrLeft.innerHTML = screen.left; var scrTop = document.getElementById ("scrTop"); scrTop.innerHTML = screen.top; var scrWidth = document.getElementById ("scrWidth"); scrWidth.innerHTML = screen.width; var scrHeight = document.getElementById ("scrHeight"); scrHeight.innerHTML = screen.height; var availLeft = document.getElementById ("availLeft"); availLeft.innerHTML = screen.availLeft; var availTop = document.getElementById ("availTop"); availTop.innerHTML = screen.availTop; var availWidth = document.getElementById ("availWidth"); availWidth.innerHTML = screen.availWidth; var availHeight = document.getElementById ("availHeight"); availHeight.innerHTML = screen.availHeight; } </script> </head> <body onload="GetDimensions ();"> <h3>Dimensions of the screen:</h3> Left: <span id="scrLeft"></span><br /> Top: <span id="scrTop"></span><br /> Width: <span id="scrWidth"></span><br /> Height: <span id="scrHeight"></span><br /> <h3>Dimensions of the available area:</h3> Left: <span id="availLeft"></span><br /> Top: <span id="availTop"></span><br /> Width: <span id="availWidth"></span><br /> Height: <span id="availHeight"></span><br /> </body> |
||||
|
||||
Did you find this example helpful?
|
External links:
User Contributed Comments