15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

458<br />

<strong>JavaScript</strong> <strong>Examples</strong> <strong>Bible</strong>: The Essential Companion to <strong>JavaScript</strong> <strong>Bible</strong><br />

Example<br />

Use the page in Listing 31-8 to see how the layerObject.visibility property<br />

settings affect a pair of nested layers. When the page first loads, the default<br />

inherit setting is in effect. Changes you make to the outer layer by clicking the<br />

outer layer buttons affect the inner layer, but setting the inner layer’s properties to<br />

hide or show severs the visibility relationship between parent and child. Listing<br />

31-19 in the <strong>JavaScript</strong> <strong>Bible</strong> shows this example with IE5+ and NN6+ syntax.<br />

Listing 31-8: Nested Layer Visibility Relationships<br />

<br />

<br />

Layer Source<br />

<br />

function setOuterVis(type) {<br />

document.outerDisplay.visibility = type<br />

}<br />

function setInnerVis(type) {<br />

document.outerDisplay.document.innerDisplay.visibility = type<br />

}<br />

<br />

<br />

<br />

Setting the layer.visibility Property of Nested Layers<br />

<br />

Click the buttons to see what happens when you change the visibility of the<br />

outer layer and inner<br />

layer objects.<br />

<br />

<br />

Control outer layer property:<br />

<br />

<br />

<br />

<br />

<br />

<br />

Control inner layer property:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Placeholder text for raw inner layer.<br />

<br />

<br />

<br />

<br />

document.layerObject.visibility

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!