window.document.body.offsetHeight returns 0

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have sharepoint portal page that has a web part page. The page has a code
to find window.document.body.offsetHeight

It returns valid value the first time. When i go to a different page and
come back to this page the above code returns 0 instead of the actual
offsetHeight.

Why is it not returning the correct value.

When i debug i get the following properties for the body of the document


?window.document.body
{...}
className: ""
id: ""
tagName: "BODY"
parentElement: {...}
style: {...}
onhelp: null
onclick: null
ondblclick: null
onkeydown: null
onkeyup: null
onkeypress: null
onmouseout: null
onmouseover: null
onmousemove: null
onmousedown: null
onmouseup: null
document: {...}
title: ""
language: "javascript"
onselectstart: null
sourceIndex: 0x5
recordNumber: null
lang: ""
offsetLeft: 0x0
offsetTop: 0x0
offsetWidth: 0x0
offsetHeight: 0x0
offsetParent: null
....

Any ideas?
 
I used

window.setTimeout('myNextFunction()',100);

I am able to get the document body properties.

Any one have any idea why i have to wait when i am running from sharepoint?
 
Back
Top