473,322 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Exact Location of an Element

This must have been covered a million times, but I'll be damned if I can
find the right information. Right now I'm using the following code:

This is a function to recusively calculate the absolute position of an
object (because you can't do it directly?):

SomeObject.prototype.__calcOffset__ = function (node) {
if (node && node.offsetTop)
return node.offsetTop + this.__calcOffset__(node.offsetParent);
else
return 0;
}

The problem is that while it worked in a simple layout it's not working
well in other layouts. Any ideas?

Brett
Jul 23 '05 #1
1 4073
Brett Foster wrote:
This must have been covered a million times, but I'll be damned if I can
find the right information. Right now I'm using the following code:

This is a function to recusively calculate the absolute position of an
object (because you can't do it directly?):

SomeObject.prototype.__calcOffset__ = function (node) {
if (node && node.offsetTop)
return node.offsetTop + this.__calcOffset__(node.offsetParent);
else
return 0;
}

The problem is that while it worked in a simple layout it's not working
well in other layouts. Any ideas?

Brett


Have a look here:

<URL:http://www.quirksmode.org/js/findpos.html>

and play with offsetParent.
--
Fred
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Johannes Busse | last post by:
hello NG, (1) I have a data-structure like the following: <element name="abc"> <source href="http://some.where.there/file/name.xhtml#location" /> </element> ... <element> ...
4
by: Marcello | last post by:
Hello I have a page of 2 frame: menu (menu.php) corpo (corpo.php) In menu.php i have: <script> function selAut(){ aut=autore.selectedIndex; aut=autore.options.value;
2
by: Vincenzo Davi | last post by:
I have created a dll with several classes in C#. One of the classes references image files in the subdirectories of the bin/Release folder (basically where the dll resides). Now, I want to use...
2
by: OtisUsenet | last post by:
Hello, I am trying to call Javascript from FORM's onSubmit, and return false, so the form is not actually submitted. Normally I can just add 'return false;' to onSubmit to accomplish this, like...
4
by: YS Sze | last post by:
If you know the exact longitude and latitude for a specific location, would anyone think it'd make any sense to find out if this set of location numbers is really part of the Fibonacci series or...
3
by: serge calderara | last post by:
Dear all, How to configure in config file, the fact that all users get access to the root web folder but only some of them to a restricted forlder Any sample ? thnaks for your help regards...
9
by: Jean Pierre Daviau | last post by:
Hi everybody, I have this function in a page (namely cours.html) function go(inValue) { var lien = 'file:///F:/MyWebs/jeanpierredaviaucom/httpdocs/cours1.html?T1=' + document.R.T1.value;
4
by: petermichaux | last post by:
Hi, I'm hoping for a reason I'm wrong or an alternate solution... I'd like to be able to dynamically include some javascript files. This is like scriptaculous.js library but their solution is...
10
by: Peter Olcott | last post by:
Someone told me that determining the exact location and current state of any JavaScript controls is pretty easy. Does anyone know exactly how this is done?
13
by: johnemmatty | last post by:
I am using an asp page in which i dynamically fill the ACTION property of the form. The problem is that whenever i try to redirect to a html page using the javascript:location, it is getting...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.