Current location: Hot Scripts Forums » General Web Coding » JavaScript » two questions regarding iframes


two questions regarding iframes

Reply
  #1 (permalink)  
Old 07-12-04, 02:27 AM
davidklonski davidklonski is offline
Newbie Coder
 
Join Date: Apr 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
two questions regarding iframes

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:
Code:
<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
Reply With Quote
  #2 (permalink)  
Old 07-12-04, 06:52 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
Question 1:
I think you can use style.offsetLeft/Top or style.offsetX/Y (don't remember which one but I could check later), it should return the correct coordinate. It might only return the coordinates relative to the frames parent element but then you just add its top-left coordinate to the ones you got etc...

Question 2:
You need to use window.opener instead of parent.
Reply With Quote
  #3 (permalink)  
Old 07-13-04, 06:15 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
Oops, remove style. before offsetLeft/Top. Just remembered that they are not part of the element styles but simple attributes.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
NEED help with positioning iframes or table on my page please help thanks cgrossi04 HTML/XHTML/XML 4 09-03-04 08:54 PM
2 questions from my side. [associations and rating] admin0 PHP 1 05-12-04 10:04 AM
2 questions 1-Webbased database access. 2-PDF data retrieval Mehre PHP 1 04-11-04 04:20 AM
Couple questions alisk8 PHP 8 02-12-04 11:45 PM
woof ruff (i'm new with a few questions) APuppyDog PHP 2 07-22-03 10:51 AM


All times are GMT -5. The time now is 10:26 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.