find position of iframe in Mac Explorer 5.x

C

christine.nguyen

I'm using offset values to find the x,y position of an iframe on an
html page. The code works in all browsers except in Mac explorer 5.x.
Does anybody have any ideas how to get around this?? Thanks. My code
is below, assuming myFrame is the iframe in question, offsetLeft is the
x coordinate, offsetTop is the y coordinate. For some reason,
offsetParent for the iframe on Mac Explorer is always undefined. Even
stranger, this is only the case for iframe elements. When dealing with
other elements in Mac Explorer 5.x, the code below works fine. Just
the darned iframes are giving me a problem. Any thoughts are
appreciated! - chh


function getMyFramePosition(){
var obj = myFrame;
var offsetLeft = 0;
var offsetTop = 0;
while (obj){
offsetLeft += offsetTrail.offsetLeft;
offsetTop += offsetTrail.offsetTop;
obj = obj.offsetParent;
}
 
J

Joshie Surber

The easiest way would be to wrap the iframe in a div, then get the
properties of said div.

But on the other hand, I would be surprised if your referer logs showed
anyone using Mac/IE5 within the past couple of years, so you may just
want to ignore them anyway... just make sure that your site content is
accessible without JavaScript (it is, right?). Someone using a browser
that far behind the times will be used to a sub-par experience anyways.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top