By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,568 Members | 1,713 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,568 IT Pros & Developers. It's quick & easy.

offsetHeight not working in Firefox

P: 16
offsetHeight is not working in following code

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function Coverdiv()
  3. {
  4.     var standard=(document.compatMode=="CSS1Compat") ? document.documentElement:document.body;
  5.     var dv = document.createElement("div");
  6.     dv.setAttribute("id","cover");
  7.     document.body.appendChild(dv);
  8.     var cover=document.getElementById("cover");
  9.     //dv.innerHTML="Samit";
  10.     cover.style.top=0+"%";
  11.     cover.style.left=0+"%";
  12.     cover.style.backgroundColor="#000000";
  13.     cover.style.zIndex=100;
  14.     cover.style.height=100+"%";
  15.     cover.style.position="absolute";
  16.  
  17.     cover.style.width=100+"%";
  18.     cover.style.height=document.body.offsetHeight;
  19.     cover.style.opacity="0.8";
  20.  
  21.     var contDiv=document.createElement("div");
  22.     contDiv.setAttribute("id","Contents");
  23.     document.body.appendChild(contDiv);
  24.     var Content=document.getElementById("Contents");
  25.  
  26.     Content.innerHTML="Samit";
  27.     Content.style.top=50+"%";
  28.     Content.style.left=50+"%";
  29.     Content.style.backgroundColor="#FFFFFF";
  30.     Content.style.zIndex=101;
  31.     Content.style.height=20+"%";
  32.     Content.style.width=20+"%"
  33.     Content.style.position="absolute";
  34. };
  35. window.onload=Coverdiv;
  36. </script>
Jul 1 '09 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
What do you expect it to be and what is it instead? Perhaps you should be using the greater of scrollHeight/offsetHeight.
Jul 1 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.