HTML and CSS Reference
In-Depth Information
EXAMPLE
10.22 (
CONTINUED
)
<tr>
<td>Available Width</td>
<td>
<script type="text/javascript">
4
document.write(
screen.availWidth
);
</script>
</td>
</tr>
<tr>
<td>Color Depth</td>
<td>
<script type="text/javascript">
5
document.write(
screen.colorDepth
);
</script>
</td>
</tr>
</table>
</font>
</body>
</html>
EXPLANATION
1
The
height
property of the
screen
object contains the height of the screen in pixels.
(To see how to create a table dynamically with JavaScript, see Chapter 15, section
“Creating a Table with the DOM” on page 644.)
2
The available height is the height minus any toolbars or other objects attached to
the window.
3
The
width
property of the
screen
object contains the width of the screen in pixels.
4
The
availWidth
is the pixel width of the screen, minus toolbars, and so on.
5
The
colorDepth
refers to the maximum number of colors that the screen can dis-
play in bit format. The display is shown in Figure 10.35.