find position of iframe in Mac Explorer 5.x

Discussion in 'Javascript' started by christine.nguyen@gmail.com, Oct 16, 2005.

  1. Guest

    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;
    }
    , Oct 16, 2005
    #1
    1. Advertising

  2. 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.
    Joshie Surber, Oct 17, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. NewTel
    Replies:
    2
    Views:
    481
    G. Whiz
    Feb 23, 2006
  2. Steve Kershaw
    Replies:
    0
    Views:
    415
    Steve Kershaw
    Aug 21, 2007
  3. Ed Hauptman
    Replies:
    7
    Views:
    1,015
    Ed Hauptman
    Aug 7, 2009
  4. Daedalous
    Replies:
    3
    Views:
    686
    Daedalous
    Jan 16, 2004
  5. Replies:
    0
    Views:
    98
Loading...

Share This Page