Entry
How do you change the z-index of an element with Netscape 6
May 27th, 2000 08:07
Martin Honnen, Ken Daniels,
You set
elementReference.style.zIndex = number
You need to know that
elementReference.style.zIndex
returns a string so if you want to manipulate that value use
elementReference.style.zIndex =
parseInt(elementReference.style.zIndex) + 1
Here is a complete example
<HTML>
<HEAD>
</HEAD>
<BODY>
<DIV STYLE="position: absolute;
left: 100px; top: 100px;
width: 100px; height: 100px;
background-color: orange;
z-index: 10;"
ONCLICK="this.style.zIndex = parseInt(this.style.zIndex) + 5"
>
</DIV>
<DIV STYLE="position: absolute;
left: 150px; top: 150px;
width: 100px; height: 100px;
background-color: lightblue;
z-index: 8;"
ONCLICK="this.style.zIndex = parseInt(this.style.zIndex) + 5"
>
</DIV>
</BODY>
</HTML>