offsetHeight is not working in following code
Code:
<script type="text/javascript">
function Coverdiv()
{
var standard=(document.compatMode=="CSS1Compat") ? document.documentElement:document.body;
var dv = document.createElement("div");
dv.setAttribute("id","cover");
document.body.appendChild(dv);
var cover=document.getElementById("cover");
//dv.innerHTML="Samit";
cover.style.top=0+"%";
cover.style.left=0+"%";
cover.style.backgroundColor="#000000";
cover.style.zIndex=100;
cover.style.height=100+"%";
cover.style.position="absolute";
cover.style.width=100+"%";
cover.style.height=document.body.offsetHeight;
cover.style.opacity="0.8";
var contDiv=document.createElement("div");
contDiv.setAttribute("id","Contents");
document.body.appendChild(contDiv);
var Content=document.getElementById("Contents");
Content.innerHTML="Samit";
Content.style.top=50+"%";
Content.style.left=50+"%";
Content.style.backgroundColor="#FFFFFF";
Content.style.zIndex=101;
Content.style.height=20+"%";
Content.style.width=20+"%"
Content.style.position="absolute";
};
window.onload=Coverdiv;
</script>
Comment