Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

zindex - can't get to work.

Status
Not open for further replies.

SueSp

MIS
Jul 26, 2004
39
US
Hello.

I'm struggling with a simple zIndex problem. I have a form in my ASP that has two radio buttons shown below. There are two <div>'s as well. When I click one of the radio buttons, I need one of the two Div's to show - the radio's toggle between the two div's. Right now, with the sample below, nothing happens. Can somebody tell me what I'm doing wrong?

This is ASP/HTML that runs only in IE 5 or higher browsers.

Thank you!

<div id='inputTableCoil' style="position: absolute; left: 310px ; top: 170px; z-index: 0">

<div id='inputTableFinished' style="position: absolute; left: 310px ; top: 170px; z-index: 1">

<input type='radio' name='LabelType' value='Coil' onclick="inputTableCoil.style.zIndex=1; inputTableFinished.style.zIndex=0">

<input type='radio' name='LabelType' value='Finished' onclick="inputTableCoil.style.zIndex=0; inputTableFinished.style.zIndex=1">
 
Instead of changing the s-index, you should change the display attribute to "none" or "block". z-index is kind of a strange option, and doesn't always work like you expect.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Thanks Tracy, can you elaborate on your suggestion?

Thank you.
 
Add this to your divs to initially hide them:
Code:
<div... style="display:none">
When you want to display them:
Code:
document.getElementById("yourdivid").style.display = "block"
To hide them again change "block" to "none".


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
You're quite welcome!


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top