Click to See Complete Forum and Search --> : two questions regarding iframes


davidklonski
07-12-2004, 02:26 AM
Hi people

I got 2 questions regarding the usage of frames:
1) How can I calculate the exact top-left coordinate of an iframe which is located in the screen? The top-left coordinate needs to be in relation to the entire screen.
2) Consider the following: Page A opens a modal window B using window.showModalDialog(). Page B contains an IFrame C which is used to interact with the server.
When IFrame C reloads, I would like page B to close and page A to reload automaticaly.
I tried the following in C's body tag:

<body onload="parent.opener.location.reload(true); parent.close();">

page B gets closed with no problem but I get a JavaScript error on the first line saying: 'parent.opener.location' is null or not an object.

I would appreciate any help in any of the questions.
regards

Kor
07-12-2004, 03:21 AM
1. use offsetLeft and offsetTop but keep in mind that these values are relative, so if your iframe is nested, the values are relative to the tag (table, cell, whichever) which nested the iframe.

2.Try
<body onload="window.opener.parent.location.reload(true); parent.close();">

davidklonski
07-12-2004, 03:29 AM
I am still getting the same error message:
window.opener.parent is null or not an object