Online Documentation Server
 ÏÎÈÑÊ
ods.com.ua Web
 ÊÀÒÅÃÎÐÈÈ
Home
Programming
Net technology
Unixes
Security
RFC, HOWTO
Web technology
Data bases
Other docs

 


 ÏÎÄÏÈÑÊÀ

 Î ÊÎÏÈÐÀÉÒÀÕ
Âñÿ ïðåäîñòàâëåííàÿ íà ýòîì ñåðâåðå èíôîðìàöèÿ ñîáðàíà íàìè èç ðàçíûõ èñòî÷íèêîâ. Åñëè Âàì êàæåòñÿ, ÷òî ïóáëèêàöèÿ êàêèõ-òî äîêóìåíòîâ íàðóøàåò ÷üè-ëèáî àâòîðñêèå ïðàâà, ñîîáùèòå íàì îá ýòîì.




Previous Table of Contents Next

These attributes control the solid background color or tiled image backdrop of a layer. They are similar to the BGCOLOR and BACKGROUND attributes of the <BODY> tag. BGCOLOR is either the name of a standard color or an RGB value. BACKGROUND is the URL of a backdrop image. Backdrop images may contain transparent pixels. Both of these attributes are optional.

By default, a layer is transparent, so layers below one with neither of these attributes show through in the areas in which a background color or pattern would have been visible.

The Layer Object

For each layer in a document there is a corresponding Layer object. A Layer object has various properties reflecting the layer’s properties. Among these properties are some that can be set such as visibility.

A Layer object also features some useful methods that enable you to control the corresponding layer in various ways. A Layer object’s properties and methods are referenced as follows:

layerObject.propertyName
layerObject.methodName(arguments)

Layer Object Properties

The properties featured by a Layer object reflect the <LAYER> tag’s HTML attributes. See the listings for each attribute for detailed explanations.

name

layerObject.name

The name property reflects the name assigned to the layer through the NAME attribute in the <LAYER> tag. You will not find this property very useful because you already know the names of layers defined in your HTML document. Note that this property is read-only, so you cannot change a layer’s name by assignment (or in any other way).

width and height

layerObject.width
layerObject.height

The width and height properties reflect a layer’s width and height in pixels, respectively.

left and top

layerObject.left
layerObject.top

These properties represent the horizontal and vertical position of the layer, respectively, relative to the origin of its parent layer. Note that both are specified as integers and measured in pixels.

Setting the value of any of these properties should normally cause the layer to move.

zIndex

layerObject.zIndex

This property reflects the relative z-order of this layer (the one represented by the specified Layer object) with respect to its siblings and parent. Sibling layers with lower numbered z-indexes are stacked underneath this layer. A layer with a negative z-index value is always stacked below its parent layer and a layer with a non-negative z-index always appears above its parent layer.

Adjusting the value of this property immediately influences the stacking of the layers in the document.

visibility

layerObject.visibility

The visibility property determines whether or not the layer is visible. It initially reflects the value of the <LAYER> tag’s VISIBILITY attribute. Therefore, this property evaluates to one of three string values:

  • "hide"
  • "show"
  • "inherit"

It is very convenient to set the visibility property, especially when creating a Web page design involving several alternating layers.

clip.top, clip.left, clip.right, clip.bottom, clip.width, and clip.height

layerObject.clip.top
layerObject.clip.left
layerObject.clip.right
layerObject.clip.bottom
layerObject.clip.width
layerObject.clip.height

These modifiable properties define the clipping rectangle, which specifies the part of the layer that is visible. Any part of the layer outside of the clipping rectangle is transparent. The clip.x properties are measured in integral number of pixels.

background

layerObject.background

The background property contains the URL of the layer’s tiled backdrop image, or null if the layer has no backdrop. This property can be set via JavaScript to change the current backdrop image.

bgColor

layerObject.bgColor

This property holds the encoded RGB value of the layer’s solid background color, or null if the layer is transparent.

siblingAbove and siblingBelow

layerObject.siblingAbove
layerObject.siblingBelow

The siblingAbove and siblingBelow properties evaluate to the Layer object above or below, respectively, the current one. The terms “above” and “below” in this case refer to the z-order among all layers that share the same parent layer. siblingAbove is null if the layer is topmost in the stack, whereas siblingBelow is null if the layer is bottommost. Like all other properties that evaluate to an object, these two properties are read-only.

above and below

layerObject.above
layerObject.below

The above and below properties evaluate to the Layer object above or below, respectively, this one in z-order, among all layers in the document, or null, if layer is topmost or bottommost, respectively. Notice the difference between these properties and the siblingAbove and siblingBelow properties—these refer to all the layers in the document, not only those sharing the same parent. As with siblingAbove and siblingBelow, above and below are read-only properties.

parentLayer

layerObject.parentLayer

This property reflects the Layer object that contains this layer, or null if this layer is not nested in another one.

layers

layerObject.layers

This property is an associative array, enumerating all child layer objects by both name and index, or null if no child layers exist. For example, the first sibling of a given layer is referenced as:

layerObject.layers[0]

or

layerObject.layers["nameOfFirstSibling"]

Layer Object Methods

Methods of a Layer object handle the current position of the layer. They affect the layout of the page when they are called.

offset()

layerObject.offset(deltaX, deltaY)

This method changes the layer’s position by applying the specified deltas, measured in pixels. Table 32-1 shows how the sign of the argument affects the movement.

Previous Table of Contents Next


With any suggestions or questions please feel free to contact us