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.
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 captureFor 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.onMouseDownandonMouseUpevents at the level of the layer and process them as you want.
layer object above this one in z-order, among all layers in the document or the enclosing window object if this layer is topmost. 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";
layer object below this one in z-order, among all layers in the document or null if this layer is at the bottom. 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".
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
captureEvents(eventType)
eventType | Type of event to be captured. Available event types are listed in the Client-Side JavaScript Guide. |
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.
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.
handleEvent(event)
event | Name of an event for which the specified object has an event handler. |
handleEvent works in tandem with captureEvents, releaseEvents, and routeEvent. For information on handling events, see the Client-Side JavaScript Guide.
Layer.x property is a convenience synonym for the left property.
Layer.top
load(sourcestring, width)
sourcestring | |
width |
moveAbove(aLayer)
aLayer |
moveBelow(aLayer)
aLayer |
moveBy(horizontal, vertical)
horizontal | The number of pixels by which to move the layer horizontally. |
vertical |
moveTo(x-coordinate, y-coordinate)
x-coordinate | An integer representing the top edge of the window in screen coordinates. |
y-coordinate | An integer representing the left edge of the window in screen coordinates. |
moveTo method in a signed script. For information on security, see the Client-Side JavaScript Guide.
Layer.moveBy
moveToAbsolute(x, y)
x | An integer representing the top edge of the window in pixel coordinates. |
y | An integer representing the left edge of the window in pixel coordinates. |
pageX and pageY properties of the layer object.
ID attribute in the LAYER tag. layer object that contains this layer, or the enclosing window object if this layer is not nested in another layer. releaseEvents(eventType)
eventType |
releaseEvents works in tandem with captureEvents, routeEvent, and handleEvent. For more information, see the Client-Side JavaScript Guide.
resizeBy(width, height)
width | The number of pixels by which to resize the layer horizontally. |
height | The number of pixels by which to resize the layer vertically. |
width and height to clip.width and clip.height.
resizeTo(width, height)
width | |
height |
clip.width and clip.height.
routeEvent(event)
event |
routeEvent works in tandem with captureEvents, releaseEvents, and handleEvent. For more information, see the Client-Side JavaScript Guide.
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 attribute.Layer.y property is a convenience synonym for the top property.
Layer.left
show means show the layer; hide means hide the layer; inherit means inherit the visibility of the parent layer.
window or Frame object that contains the layer, regardless of whether the layer is nested within another layer.x property is a convenience synonym for the Layer.left property.
Layer.y
y property is a convenience synonym for the Layer.top property.
Layer.x
zIndex must be 0 or a positive integer.
Last Updated: 05/28/99 11:59:42