The problem is the document.write. You can't do that in a .ready() or
.load() or any time except when the document is first loading. (Some
browsers allow it anyway; most don't.)

$(window).height() should be valid while the document is loading. If you
make your document.write calls directly inline while the page loads - not in
the ready function and not in an onload function either - then it should
work.

Or, if you do anything other than a document.write - it can even be an
alert() for testing - that should work inside the ready function.

BTW, you don't need to use both onload and document ready. Pick one or the
other. If you're in an onload function, the document is definitely ready and
there's no need for the extra ready call.

-Mike

> From: jquery-en@googlegroups.com 
> 
> can anyone point me to where i can get the window height or 
> viewport height of the current window.  the code (below) in 
> the onload event doesn't return anything in IE 6 or Chrome 
> but does work in FF3
> 
> i just need the height so i can adjust another element on the 
> page to fit in and leave a footer at the bottom of the page
> 
> $(document).ready(function(){
>       // Your code here
> 
>       document.write('hello world<br>');
>       document.write( $(window).height() );
> 
> });

Reply via email to