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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to use z-indexes for some elements, not getting what I want...

Status
Not open for further replies.

Maim

Programmer
Jun 25, 1999
106
CA
What am I missing here? btw, this seems to only work in IE, which is fine for the moment...

Code:
<html>
<head>
<title>Language selector</title>
<style type=&quot;text/css&quot;>
div.lang{
	position: absolute;
	visibility:'hidden';
	font-size: 10px;
	float: left;
	border: 1px solid #000000;
	padding: 2px 2px 2px 2px ;
	z-index: 0;
}
.set1
{
	font-size: 10px;
	font-family: verdana,geneva;
	size: 10;
}
</style>
<script language=&quot;javascript&quot;>
function showDiv()
{
	var curDiv = document.getElementById('lang')
	if( curDiv.shown == '0' )
	{
		curDiv.style.visibility = 'visible';
		curDiv.style.zIndex = 100;
		curDiv.shown = '1';
	}
	else
	{
		curDiv.style.visibility = 'hidden';
		curDiv.style.zIndex = 0;
		curDiv.shown = '0';
		document.getElementById('curLang').value = document.getElementById('langE').value
		document.getElementById('curLang1').value = document.getElementById('langF').value
	}
}
</script>
</head>
<body>
<table border=&quot;0&quot; cellspacing=&quot;1&quot; cellpadding=&quot;1&quot;>
<tr>
<td width=&quot;60&quot; class=&quot;set1&quot;>English:</td>
<td><input class=&quot;set1&quot; type=&quot;text&quot; id=&quot;curLang&quot; lang=&quot;E&quot; readonly></td>
<td><button onclick=&quot;showDiv()&quot; style=&quot;width:10px;height:10px&quot;></button></td>
</tr>
<tr>
<td colspan=&quot;3&quot;>
	<div class=&quot;lang&quot; id=&quot;lang&quot; shown=&quot;0&quot;>
		<table border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
		<tr>
		<td width=&quot;60&quot; class=&quot;set1&quot;>English:</td>
		<td><input class=&quot;set1&quot; type=&quot;text&quot; id=&quot;langE&quot;></td>
		</tr>
		<tr>
		<td width=&quot;60&quot; class=&quot;set1&quot;>French:</td>
		<td><input class=&quot;set1&quot; type=&quot;text&quot; id=&quot;langF&quot;></td>
		</tr>
		</table>
	</div>
</td>
</tr>
<tr style=&quot;position:relative;top:-2&quot;>
<td class=&quot;set1&quot;>French:</td>
<td><input class=&quot;set1&quot; type=&quot;text&quot; id=&quot;curLang1&quot; lang=&quot;F&quot; readonly></td>
<td class=&quot;set1&quot;>Stuff that's supposed to be below the div is dynamic...</td>
</tr>
</table>
</body>
</html>

You'll notice that when you click the button, the div that appears doesn't hide the contents directly below it.

Thanks in advance.

-----------------------------------
&quot;Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.&quot; - Rich Cook
 
Hey maim ....

I believe that unless you physically set it, the background of your div element is transparent ... no matter what z-index you set it at.

Add this line to div.lang style definition:

background-color: white;

HTH

Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top