...

View Full Version : zIndex question



KenA
01-29-2007, 08:53 AM
Hi. Im trying to overlay a div box over a input element so this overlay div should act as a modal over the input element, but i think im doing something wrong. Plese refer to the code snippet below:



<script type="text/javascript">
//debugger;
var oModalBackground = document.createElement('div');
oModalBackground.className = "modalBackground";
oModalBackground.style.width = 800;
oModalBackground.style.height = 800;
oModalBackground.style.position = "absolute";
oModalBackground.style.zIndex = 10000;
document.body.appendChild(oModalBackground);
</script>

<style type="text/css">
.modalBackground
{
border:solid 1px #ccc;
}
</style>

<input type="button" value="teste" />

The button is still clickable!

felgall
01-29-2007, 09:00 PM
You haven't assigned a zIndex to the button and it therefore automatically gets one theat is one greater than that of the previous element which puts it in front of your modal div.

Arbitrator
01-29-2007, 10:44 PM
oModalBackground.style.width = 800;
oModalBackground.style.height = 800;The button is still clickable!For one, units are required in CSS. Thus:


oModalBackground.style.width = "800px";
oModalBackground.style.height = "800px";



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum