Need to get offsetLeft of an iframe or div inside another iframe

Discussion in 'Javascript' started by Nathan Carr, Sep 17, 2004.

  1. Nathan Carr

    Nathan Carr Guest

    I'm having trouble getting the offsetLeft of an iframe that is inside
    a div tag inside another iframe that is inside a frame.

    I have something like this (inside main.asp)

    <DIV id="divHeader" name="divHeader"
    style="position:relative;left:0;top:0;width:660;height:10;z-index:1">
    <IFRAME NAME="iHeader" src="header.asp" frameborder=0
    marginheight=0 marginwidth=0 width=100% height=100%
    scrolling=no></IFRAME>
    </DIV>


    inside header.asp

    <DIV id="divAccounts" name="divAccounts"
    style="position:relative;left:0;top:0;width:100%;height:69;z-index:1">
    <iframe id="iAccounts" name="iAccounts" src="somewhere.asp"
    width="100%" height="69" frameborder="0" scrolling="yes" align="top"
    marginwidth=0 marginheight=0 hspace=0 vspace=0></iframe>
    </div>


    I'm trying to do this...
    top.document.getElementById("divHeader").document.getElementById("iHeader").document.getElementByID("divAccounts").offsetLeft

    or

    top.document.getElementById("divHeader").document.getElementById("iHeader").document.getElementByID("iAccounts").offsetLeft

    it just gives me an error.

    when i do
    top.document.getElementById("divHeader").document.getElementById("iHeader").name,
    i can get the proper name, so that's the point where I am lost

    any help would be appreciated. thanks in advance.
     
    Nathan Carr, Sep 17, 2004
    #1
    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. Daedalous
    Replies:
    3
    Views:
    827
    Daedalous
    Jan 16, 2004
  2. Pieter Van Waeyenberge
    Replies:
    2
    Views:
    164
    Pieter Van Waeyenberge
    Feb 16, 2004
  3. Dwayne Madsen

    Q: Div A inside Div B is larger than Div B

    Dwayne Madsen, Jun 1, 2005, in forum: Javascript
    Replies:
    1
    Views:
    241
    David Dorward
    Jun 1, 2005
  4. Joe Attardi
    Replies:
    0
    Views:
    563
    Joe Attardi
    Jan 17, 2006
  5. 123Jim
    Replies:
    0
    Views:
    160
    123Jim
    May 16, 2011
Loading...

Share This Page