[thelist] dom gives me a headache
Peter-Paul Koch
gassinaumasis at hotmail.com
Sat Dec 15 08:02:20 CST 2001
>today must be my lucky day, because i found *exactly* what i needed on the
>first page of google search results
>
>i was looking for a tutorial, actually, using the search string "offsetTop
>AND offsetLeft AND position" and i can't believe i found a ready made
>script --
>
> http://www.mattkruse.com/javascript/anchorposition/
>
>anybody interested in this should read that source code
>
>better make a stiff drink first, you'll be there a while i had no idea the
>document object model was so complex
Hmmm...he made it more complex than it needs to be.
BTW: this has little to do with the DOM, coordinates of an HTML element
on-screen are no part of the DOM (though the elements themselves are, of
course).
>you'd think there would be a couple variables floating around with an
>object's offsets, but no, you gotta climb the friggin dom tree adding up
>all the offsets until you reach a null parent (hmmm, sounds vaguely like a
>reflexive database table relationship...)
*Sometimes* you have to climb up the tree, but not always. I admit this
script seems to work with the simple test he provided, but will it always
work, also in far more complex document structures...?
Sorry, but I'm not very impressed. I could be wrong, of course, but I think
this script is far too complex and sometimes won't function properly.
Try mine (I already sent the URL, but repeating it won't hurt):
http://www.xs4all.nl/~ppk/js/index.html?findpos.html
ppk
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
More information about the thelist
mailing list