Use var body= document.getElementsByTagName('body')[0] body.appendChild( div ); body.removeChild( div );
On Jun 5, 9:07 pm, Lideln <lid...@gmail.com> wrote: > Hi ! > > I have an issue... What is weird, is that my colleagues don't have > it ! (and I did not have it this morning) > It happens only on IE6... Everything is fine under Firefox (3), Safari > (4 beta) and Opera (9.64). > > When logging in into my application, IE tells me "document.body is > null or is not an object". > I have the IE6 debugger installed, and it points me toward : (I used > the "normal" jquery version to show the plain text code) > > [code] > // Figure out if the W3C box model works as expected > // document.body must exist before we can do this > jQuery(function(){ > var div = document.createElement("div"); > div.style.width = div.style.paddingLeft = "1px"; > > document.body.appendChild( div ); <--- error happens here > jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; > document.body.removeChild( div ).style.display = 'none';}); > > [/code] > > How can this be possible ? > > Thank you for any possible lead that could help me get rid of this > error... > > Kind regards,