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!

overlapping divs and layers?

Status
Not open for further replies.

xpblueScreenOfDeath

Programmer
Sep 1, 2004
87
How come I can't click on the button that is above the link in IE(works perfectly in firefox) and how to solve it? I know it is a stupid example, but it is base on a real problem that is similiar in concept.

Code:
<html>
<head>
</head>
<body>
    <form>
	<Div>
	<Div style="overflow: hidden; width: 80px; float: left; opacity: 0; filter: alpha(opacity=0); z-index: 2">
		<input type="button" name="myFile" style="position: relative;" onclick="alert('button click')" value=abcd />
        </Div><DIV style="overflow: hidden; width: 80px; position: relative; Left: -80px; z-index: 1"><a href="javascript:alert('link click')">testing</a></DIV>
	</Div>
    </form>
</body>
</html>

Since, the button has a higher z-index doesn't that mean it should be above the link; therefore only the button's action can be called. In IE, I could only get the link's action to be called, but in firefox I could only get the button's action called which is the complete opposite. How can I make it work in IE like mozilla.
 
Never mind I figured it out. z-index only works for absolute positioned layers. It works after I change the code to this:

Code:
<html>
<head>
</head>
<body>
    <form>
    <Div>
    <DIV style="overflow: hidden; width: 80px; position: relative;"><a href="javascript:alert('link click')">testing</a></DIV>
    </Div>
    <Div style="overflow: hidden; Position: relative; left: -80px; width: 80px; float: left; opacity: 0; filter: alpha(opacity=0);">
        <input type="button" name="myFile" style="position: relative;" onclick="alert('button click')" value=abcd />
        </Div>
    </form>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top