Jed,
forgot to say that you probably have to wrap those alert inside a
"readystatechange" for IE or similar for other browsers.
You have to wait for all the elements to be loaded in the parent
window before getting dimensions.
Here is the code I used to test:
<html>
<head>
<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript">
window.parent.document.onreadystatechange = function() {
if (window.parent.document.readyState == 'complete') {
alert( $( window.parent.document ) );
// CORRECT: alerts "[object Object]"
alert( $( window.parent.document.body ).height() );
// CORRECT: alerts "154"
alert( $( window.parent.document ).height() );
// ERROR: "Could not convert JavaScript argument arg 0"
alert( $( window.parent ).height() );
// ERROR: "Could not convert JavaScript argument arg 0"
}
};
</script>
</head>
</html>
And it seems to me something is wrong with the numbers I get. As said
above a full review of that code part is needed.
Diego
On 8 Mag, 06:34, Jed Schmidt <[email protected]> wrote:
> Hello all.
>
> I have two html documents.
>
> (1) parent.html
>
> <html>
> <body>
> <iframe src="child.html"/>
> </body>
> </html>
>
> (2) child.html
>
> <html>
> <head>
> <script type="text/javascript" src="http://ajax.googleapis.com/
> ajax/libs/jquery/1.3.2/jquery.min.js"></script>
> <script type="text/javascript">
> alert( $( window.parent.document ) );
> // CORRECT: alerts "[object Object]"
>
> alert( $( window.parent.document.body ).height() );
> // CORRECT: alerts "154"
>
> alert( $( window.parent.document ).height() );
> // ERROR: "Could not convert JavaScript argument arg 0"
>
> alert( $( window.parent ).height() );
> // ERROR: "Could not convert JavaScript argument arg 0"
> </script>
> </head>
> </html>
>
> As is visible from the code, I'm having trouble getting the height of
> the document in the parent window. I can access the window, document,
> and body of the parent without issue, but can only access the height
> of the parent's body. An error is thrown when I try to access the
> height of the parent window or document.
>
> Is there something I'm missing here, or does this need a ticket?
>
> Jed Schmidt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---