/* JavaScript Bible, Fourth Edition by Danny Goodman
John Wiley & Sons CopyRight 2001 */
<HTML> <HEAD> <TITLE>layer.style.zIndex</TITLE> <SCRIPT LANGUAGE="JavaScript"> function setZ(field) { switch (field.name) { case "top" : document.getElementById("topLayer").style.zIndex = parseInt(field.value) break case "mid" : document.getElementById("middleLayer").style.zIndex = parseInt(field.value) break case "bot" : document.getElementById("bottomLayer").style.zIndex = parseInt(field.value) } showValues() } function showValues() { var botLayer = document.getElementById("bottomLayer") var midLayer = document.getElementById("middleLayer") var topLayer = document.getElementById("topLayer")
document.forms[0].bot.value = botLayer.style.zIndex document.forms[1].mid.value = midLayer.style.zIndex document.forms[2].top.value = topLayer.style.zIndex } </SCRIPT> </HEAD> <BODY onLoad="showValues()"> <H1><TT>layer.style.zIndex</TT> Property of Sibling Layers</H1> <HR> Enter new zIndex values to see the effect on three layers.<P> <DIV STYLE="position:absolute; top:140; width:240; background-color:coral"> <FORM> Control Original Bottom Layer:<BR>