Javascript screen width property returns the width of display screen. width property of javascript screen object actually returns the number of pixels in horizontal direction i.e. horizontal value for screen resolution along x-axis. Javascript screen object width property depends upon the screen resolution of client system. For example if screen resolutions of client’s PC is 800 X 600 then it represents the width as 800 pixels in a single horizontal row along x-axis and width property of javascript screen object returns the value equal to 800. You can see the screen resolution property in the display properties of the computer system that can be accessed by right clicking on desktop and selecting the properties from the menu or by selecting Display icon in the control panel. Display properties dialog box shows the tabs for different types of display settings such as wallpaper, screensaver, themes, appearance and settings. In the settings tab you can see the current value of screen resolutions.
Syntax for Javascript screen width property
screen.width
or
window.screen.width
You can use any of the above syntax to access the javascript screen width property.
Examples of Javascript screen width property
<script type="text/javascript" language="javascript">
document.write(screen.width);
document.write("<br />");
document.write(window.screen.width);
</script>
Continue to next tutorial: Javascript Window Screen Object to get information about all the properties of JavaScript Screen object.