Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Need to get offsetLeft of an iframe or div inside another iframe

Thread Tools

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

Nathan Carr
Posts: n/a
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;he ight:10;z-index:1">
<IFRAME NAME="iHeader" src="header.asp" frameborder=0
marginheight=0 marginwidth=0 width=100% height=100%

inside header.asp

<DIV id="divAccounts" name="divAccounts"
style="position:relative;left:0;top:0;width:100%;h eight: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>

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


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.
Reply With Quote

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
drag div from inside div to inside another 123Jim Javascript 0 05-16-2011 08:36 AM
Div inside an iframe - how to set height relative to the iframe's visible size? Joe Attardi Javascript 0 01-17-2006 08:01 PM
Q: Div A inside Div B is larger than Div B Dwayne Madsen Javascript 1 06-01-2005 03:02 PM
Different offsetLeft/Top calculation for elements contained in DIV and TABLE/TD Pieter Van Waeyenberge Javascript 2 02-16-2004 02:21 PM
Get form values from iframe (1) to iframe (2) inside a layer in iframe (1) Daedalous Javascript 3 01-16-2004 11:08 AM