Screen object contains information about the client’s screen . Different users can have different screen sizes and types. In case we want to create something we should keep in mind the screen dimensions will not be same and because the screen sizes will not be same so other properties will also require attention. The properties of screen object are listed below. |
Properties: |
height width availHeight availWidth |
height |
This screen property returns the screen height . |
Example: |
<html>
<head> </head> <body bgcolor=red text=yellow> <script type=”text/javascript”> document.write(“<br> the work area height is “+screen.height + ” px.”) </script> </body> </html> |
Click here to view result of this program on browser |
Width |
This screen property returns the screen width . Different screens can have different dimensions , width property returns the height of the screen in use. A programmer can program suitably after knowing the height of screen in use. |
Example |
<html>
<head> </head> <body bgcolor=red text=yellow> <script type=”text/javascript”> document.write(“<br> the screen width is “+screen.width + ” px.”) </script> </body> </html> |
Click here to view result of this program on browser |
availheight |
This screen property returns the screen height (screen height– taskbar). A web page is displayed on the screen availheight property returns the screen height which can be calculated by total screen height – height of taskbar. |
Example: |
<html>
<head> </head> <body bgcolor=red text=yellow> <script type=”text/javascript”> document.write(“<br> the work area height is “+screen.availheight + ” px.”) </script> </body> </html> |
Click here to view result of this program on browser |
availwidth |
This screen property returns the screen width (screen width– taskbar). Different screens can have different dimensions , availwidth property returns the screen web page available width of the screen in use. A programmer can program suitably after knowing the height of screen in use. |
Example: |
<html>
<head> </head> <body bgcolor=red text=yellow> <script type=”text/javascript”> document.write(“<br> the work area height is “+screen.availheight + ” px.”) </script> </body> </html> |