Table of Contents | Previous
| Next
| Index
Corresponds to a layer in an HTML page and provides a means for manipulating that layer.
The HTML LAYER or ILAYER tag, or using cascading style sheet syntax. The JavaScript runtime engine creates a Layer object corresponding to each layer in your document. It puts these objects in an array in the document.layers property. You access a Layer object by indexing this array.
To define a layer, use standard HTML syntax. If you specify the ID attribute, you can use the value of that attribute to index into the layers array.
For a complete description of layers, see Dynamic HTML in Netscape Communicator.
Some layer properties can be directly modified by assignment; for example, "mylayer.visibility = hide". A layer object also has methods that can affect these properties.
|
Property
|
Description
above
|
The layer object above this one in z-order, among all layers in the document or the enclosing window object if this layer is topmost.
| background
|
The image to use as the background for the layer's canvas.
| bgColor
|
The color to use as a solid background color for the layer's canvas.
| below
|
The layer object below this one in z-order, among all layers in the document or null if this layer is at the bottom.
| clip.bottom
|
The bottom edge of the clipping rectangle (the part of the layer that is visible.)
| clip.height
|
The height of the clipping rectangle (the part of the layer that is visible.)
| clip.left
|
The left edge of the clipping rectangle (the part of the layer that is visible.)
| clip.right
|
The right edge of the clipping rectangle (the part of the layer that is visible.)
| clip.top
|
The top edge of the clipping rectangle (the part of the layer that is visible.)
| clip.width
|
The width of the clipping rectangle (the part of the layer that is visible.)
| document
|
The layer's associated document.
| left
|
The horizontal position of the layer's left edge, in pixels, relative to the origin of its parent layer.
| name
|
A string specifying the name assigned to the layer through the ID attribute in the LAYER tag.
| pageX
|
The horizontal position of the layer, in pixels, relative to the page.
| pageY
|
The vertical position of the layer, in pixels, relative to the page.
| parentLayer
|
The layer object that contains this layer, or the enclosing window object if this layer is not nested in another layer.
| siblingAbove
|
The layer object above this one in z-order, among all layers that share the same parent layer, or null if the layer has no sibling above.
| siblingBelow
|
The layer object below this one in z-order, among all layers that share the same parent layer, or null if layer is at the bottom.
| src
|
A string specifying the URL of the layer's content.
| top
|
The vertical position of the layer's top edge, in pixels, relative to the origin of its parent layer.
| visibility
|
Whether or not the layer is visible.
| window
|
The window or Frame object that contains the layer, regardless of whether the layer is nested within another layer.
| x
|
A convenience synonym for Layer.left.
| y
|
A convenience synonym for Layer.top.
| zIndex
|
The relative z-order of this layer with respect to its siblings.
| |
|---|
In addition, this object inherits the watch and unwatch methods from Object.
NOTE:
Just as in the case of a document, if you want to define mouse click response
for a layer, you must capture onMouseDown and onMouseUp events at the
level of the layer and process them as you want.
For details about capturing events, see the Client-Side JavaScript Guide.
If an event occurs in a point where multiple layers overlap, the topmost layer gets the event, even if it is transparent. However, if a layer is hidden, it does not get events.
The layer object above this one in z-order, among all layers in the document or the enclosing window object if this layer is topmost.
The image to use as the background for the layer's canvas (which is the part of the layer within the clip rectangle).
Each layer has a background property, whose value is an image object, whose src attribute is a URL that indicates the image to use to provide a tiled backdrop. The value is null if the layer has no backdrop. For example:
layer.background.src = "fishbg.gif";
The layer object below this one in z-order, among all layers in the document or null if this layer is at the bottom.
A string specifying the color to use as a solid background color for the layer's canvas (the part of the layer within the clip rectangle).
The bgColor property is expressed as a hexadecimal RGB triplet or as a string literal (see the Client-Side JavaScript Guide). This property is the JavaScript reflection of the BGCOLOR attribute of the BODY tag.
You can set the bgColor property at any time.
If you express the color as a hexadecimal RGB triplet, you must use the format rrggbb. For example, the hexadecimal RGB values for salmon are red=FA, green=80, and blue=72, so the RGB triplet for salmon is "FA8072".
The following example sets the background color of the myLayer layer's canvas to aqua using a string literal:
myLayer.bgColor="aqua"
The following example sets the background color of the myLayer layer's canvas to aqua using a hexadecimal triplet:
myLayer.bgColor="00FFFF"
Layer.bgColor
Sets the window or document to capture all events of the specified type.
captureEvents(eventType)
When a window with frames wants to capture events in pages loaded from different locations (servers), you need to use captureEvents in a signed script and precede it with enableExternalCapture. For more information and an example, see enableExternalCapture.
captureEvents works in tandem with releaseEvents, routeEvent, and handleEvent. For information on handling events, see the Client-Side JavaScript Guide.
The bottom edge of the clipping rectangle (the part of the layer that is visible.) Any part of a layer that is outside the clipping rectangle is not displayed.
The height of the clipping rectangle (the part of the layer that is visible.) Any part of a layer that is outside the clipping rectangle is not displayed.
The left edge of the clipping rectangle (the part of the layer that is visible.) Any part of a layer that is outside the clipping rectangle is not displayed.
The right edge of the clipping rectangle (the part of the layer that is visible.) Any part of a layer that is outside the clipping rectangle is not displayed.
The top edge of the clipping rectangle (the part of the layer that is visible.) Any part of a layer that is outside the clipping rectangle is not displayed.
The width of the clipping rectangle (the part of the layer that is visible.) Any part of a layer that is outside the clipping rectangle is not displayed.
The layer's associated document.
Each layer object contains its own document object. This object can be used to access the images, applets, embeds, links, anchors and layers that are contained within the layer. Methods of the document object can also be invoked to change the contents of the layer.
Invokes the handler for the specified event.
handleEvent(event)
handleEvent works in tandem with captureEvents, releaseEvents, and routeEvent. For information on handling events, see the Client-Side JavaScript Guide.
The horizontal position of the layer's left edge, in pixels, relative to the origin of its parent layer.
The Layer.x property is a convenience synonym for the left property.
Layer.top
Changes the source of a layer to the contents of the specified file and simultaneously changes the width at which the layer's HTML contents are wrapped.
load(sourcestring, width)
Stacks this layer above the layer specified in the argument, without changing either layer's horizontal or vertical position. After re-stacking, both layers will share the same parent layer.
moveAbove(aLayer)
Stacks this layer below the specified layer, without changing either layer's horizontal or vertical position. After re-stacking, both layers will share the same parent layer.
moveBelow(aLayer)
Changes the layer position by applying the specified deltas, measured in pixels.
moveBy(horizontal, vertical)
Moves the top-left corner of the window to the specified screen coordinates.
moveTo(x-coordinate, y-coordinate)
To move a window offscreen, call the moveTo method in a signed script. For information on security, see the Client-Side JavaScript Guide.
Changes the layer position to the specified pixel coordinates within the containing layer. For ILayers, moves the layer relative to the natural inflow position of the layer.
Layer.moveBy
Changes the layer position to the specified pixel coordinates within the page (instead of the containing layer.)
moveToAbsolute(x, y)
This method is equivalent to setting both the pageX and pageY properties of the layer object.
A string specifying the name assigned to the layer through the ID attribute in the LAYER tag.
The horizontal position of the layer, in pixels, relative to the page.
The vertical position of the layer, in pixels, relative to the page.
The layer object that contains this layer, or the enclosing window object if this layer is not nested in another layer.
Sets the window or document to release captured events of the specified type, sending the event to objects further along the event hierarchy.
releaseEvents(eventType)
If the original target of the event is a window, the window receives the event even if it is set to release that type of event. releaseEvents works in tandem with captureEvents, routeEvent, and handleEvent. For more information, see the Client-Side JavaScript Guide.
Resizes the layer by the specified height and width values (in pixels).
resizeBy(width, height)
This does not layout any HTML contained in the layer again. Instead, the layer contents may be clipped by the new boundaries of the layer. This method has the same effect as adding width and height to clip.width and clip.height.
Resizes the layer to have the specified height and width values (in pixels).
This does not layout any HTML contained in the layer again. Instead, the layer contents may be clipped by the new boundaries of the layer.
resizeTo(width, height)
This method has the same effect setting clip.width and clip.height.
Passes a captured event along the normal event hierarchy.
routeEvent(event)
If a sub-object (document or layer) is also capturing the event, the event is sent to that object. Otherwise, it is sent to its original target.
routeEvent works in tandem with captureEvents, releaseEvents, and handleEvent. For more information, see the Client-Side JavaScript Guide.
The layer object above this one in z-order, among all layers that share the same parent layer or null if the layer has no sibling above.
The layer object below this one in z-order, among all layers that share the same parent layer or null if layer is at the bottom.
A URL string specifying the source of the layer's content. Corresponds to the SRC attribute.
The vertical position of the layer's left edge, in pixels, relative to the origin of its parent layer.
The Layer.y property is a convenience synonym for the top property.
Layer.left
Whether or not the layer is visible.
A value of show means show the layer; hide means hide the layer; inherit means inherit the visibility of the parent layer.
The window or Frame object that contains the layer, regardless of whether the layer is nested within another layer.
The horizontal position of the layer's left edge, in pixels, relative to the origin of its parent layer.
The x property is a convenience synonym for the Layer.left property.
Layer.y
The vertical position of the layer's left edge, in pixels, relative to the origin of its parent layer.
The y property is a convenience synonym for the Layer.top property.
Layer.x
The relative z-order of this layer with respect to its siblings.
Sibling layers with lower numbered z-indexes are stacked underneath this layer. The value of zIndex must be 0 or a positive integer.
Table of Contents | Previous
| Next
| Index
Last Updated: 05/28/99 11:59:42
Copyright (c) 1999
Netscape Communications Corporation
|