August 1999
Intermediate to advanced
1488 pages
72h 53m
English
document.layers.length
The length property contains the number of objects that are in the layers[] array.
Listing 7.142 creates two layers and then displays the number of layers on the bottom of the page using the length property.
<html>
<layer name="Layer1"
pagex=50
pagey=50
width=100
height=100
bgcolor="blue">Layer 1</layer>
<layer name="Layer2"
pagex=150
pagey=150
width=100
height=100
bgcolor="red">Layer 2</layer>
<script language="JavaScript">
<!--Hide
//Display the length of the layers array.
document.write(document.layers.length," layer objects.");
//Hide End --->
</script>
</html>
|
Read now
Unlock full access