aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Find iframe element absolute coordinates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Find iframe element absolute coordinates" Watch "Find iframe element absolute coordinates" New topic
Author

Find iframe element absolute coordinates

dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
I have a small iframe with elements when I move mouse over I want to see status popup fed by Ajax. It works fine, however popup div defined in iframe can't overlap parent window and gets clipped out. For this reason I moved it in a main window. Now I have to figure main window coordinates of popup which will be shown by side of an iframe element. I tried iframe.offsetTop and iframe.offsetLeft added to element coordinates, however they are always 0. I found work around using coordinates of an element where iframe inserted in, but it won't be always the case. So, how I can find absolute coordinates of iframe? Sorry for a beginner question.


Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
basic idea:



Eric
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
Bingo. I forgot that my iframe inside some other element.
Riho Richards
Greenhorn

Joined: Mar 31, 2006
Posts: 3
Hello I have a problem related to this.

I have the following iframe:



this iframe tag is enclosed with <td> tags and I would like to extract the location and coordinates of the iframe. I happened to have a very similar function that does this:



So, to get the top location of my iframe, i make a call:

getCurrTop("myContent");

This works perfectly fine in firefox, but returns 0 in internet explorer... any idea why? Thanks in advance for your help.

[ March 31, 2006: Message edited by: Riho Richards ]

[ March 31, 2006: Message edited by: Riho Richards ]
[ April 03, 2006: Message edited by: Riho Richards ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
and ad is?
Riho Richards
Greenhorn

Joined: Mar 31, 2006
Posts: 3
oops sorry, hehe code is fixed... i applied the modification and i still get the same problem.
Riho Richards
Greenhorn

Joined: Mar 31, 2006
Posts: 3
sorry i'm just being dumb... it was a bug elsewhere that caused my issue. thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Find iframe element absolute coordinates
 
Similar Threads
Prevent opening page in new window
Need Help in JEditorPane
iframe and struts url won't work
Popup in jsp is not working becouse of Iframe
Finding X Y location of button