Team LiB   Previous Section   Next Section
Layer Client-side Netscape 4 only

An independent document layer

Synopsis

document.layers[i]
document.layers[layer-name]
document.layer-name

Constructor

new Layer(width, parent_layer)

Description

The Layer object is supported only in Netscape 4 and was discontinued in Netscape 6. It is entirely non-standard, but is documented here because it provides the only way to work with dynamically positioned objects in Netscape 4. Any HTML element with a CSS position attribute of absolute is represented by a Layer object in JavaScript. You can also create layers with the non-standard <layer> tag, or with the Layer( ) constructor.

Properties

above

The layer above this one, if any. Read-only.

background

The background image of the layer.

below

The layer below this one, if any. Read-only.

bgColor

The background color of the layer.

clip.bottom

The Y-coordinate of the bottom edge of the layer's clipping area, relative to top.

clip.height

The height of the layer's clipping area. Setting this property also sets the value of clip.bottom.

clip.left

The X-coordinate of the left edge of the layer's clipping area, relative to left.

clip.right

The X-coordinate of the right edge of the layer's clipping area, relative to left.

clip.top

The Y-coordinate of the top edge of the layer's clipping area, relative to top.

clip.width

The width of the layer's clipping area. Setting this property also sets the value of clip.right.

document

A read-only reference to the Document object contained within the layer.

hidden

Specifies whether a layer is hidden or visible. Setting this property to true hides the layer, and setting it to false makes the layer visible.

layers[ ]

An array that contains any child Layer objects of this layer. It is the same as the document.layers[ ] array of a layer.

left

The X-coordinate of this layer, relative to the containing layer or document. Setting this property moves the layer to the left or right. left is a synonym for x.

name

The name attribute of the HTML tag represented by this layer.

pageX, pageY

The X and Y-coordinates of this layer relative to the top-level document. Note that these coordinates are relative to the top-level page, not relative to any containing layer.

parentLayer

A read-only reference to the Layer or Window object that contains (is the parent of) this layer.

siblingAbove, siblingBelow

These properties refer to the sibling Layer object (i.e., a child of the same parent Layer) immediately above or below this layer in the stacking order. If there is no such layer, these properties are null.

src

A read/write string that specifies the URL, if any, of the contents of a layer. Setting this property to a new URL causes the browser to read the contents of that URL and display them in the layer.

top

The Y-coordinate of this layer relative to the containing layer or document. Setting this property moves the layer up or down. top is a synonym for y.

visibility

A read/write string that specifies the visibility of the layer. The three legal values are: "show", "hide", and "inherit".

window

The Window object that contains the layer, regardless of how deeply nested the layer is within other layers.

x, y

The X and Y-coordinates of the layer. x is a synonym for the left property and y is a synonym for the top property.

zIndex

The position of the layer in the z-order, or stacking order, of layers. When two layers overlap, the one with the higher zIndex appears on top and obscures the one with the lower zIndex. If two sibling layers have the same zIndex, the one that appears later in the layers[ ] array of the containing document is displayed later and overlaps the one that appears earlier.

Methods

load( src, width)

Loads a new URL into the layer, sets the layer width, and returns nothing.

moveAbove( other_layer)

Moves this layer above another and returns nothing.

moveBelow( other_layer)

Moves this layer below another and returns nothing.

moveBy( dx, dy)

Moves the layer relative to its current position and returns nothing.

moveTo( x, y)

Moves the layer to the point (x,y) relative to its containing layer or window and returns nothing.

moveToAbsolute( x, y)

Moves the layer to a position relative to the page and returns nothing.

resizeBy( dw, dh)

Resizes the layer by the specified amounts and returns nothing.

resizeTo( width, height)

Resizes the layer to the specified size returns nothing.

    Team LiB   Previous Section   Next Section