Name

Layer — an independent layer in a DHTML document

Availability

Netscape 4 only; discontinued in Netscape 6

Synopsis

document.layers[i]

Constructor

new Layer(width, parent)

Arguments

width

The width of the new layer, in pixels.

parent

The Layer or Window that should be the parent of this newly created layer. This argument is optional; if omitted, the new layer is a child of the current window.

Notes

The Layer( ) constructor creates a new Layer object and returns it. You can set its size, position, and other attributes with the various Layer properties and methods described in the following lists. In particular, you must set the hidden property to false to make the new layer visible. See the src property and load( ) methods in particular for ways to set the content of a layer. Alternatively, you can dynamically generate content for the layer by writing to its document property.

Note that you can only call the Layer( ) constructor once the current document and all of its layers have finished loading.

Properties

above

A read-only property that refers to the Layer object immediately above layer in the stacking order. If there is no such layer, above is null.

background

An Image object that specifies the image displayed in the background of the layer. The initial value of this property is specified by the background attribute of the <layer> tag. You can change the image displayed in the background of the layer by setting the background.src property. If set to null, no image is displayed, ...

Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.