[thelist] dom gives me a headache

Ben Henick persist1 at io.com
Fri Dec 14 14:42:30 CST 2001


On Fri, 14 Dec 2001, rudy wrote:

> the hiermenus documentation (feh! if you can call it that!) simply says
>
>    "You can create a function that finds the correct
>    position each time the menu needs to be displayed."
>
> so far, so good, but i cannot seem to write this function
>
> what i want is to pass the function the image id or name (notice they are
> cleverly the same) and get back the top and left coordinates

If you know that you're dealing with an image, try using the
document.images array instead:

blah_left = document.images["foo"].offsetLeft;
 blah_top = document.images["foo"].offsetTop;

And of course you can replace "foo" with an expression.

Why you cannot accomplish the same with document.all, mystifies me.

Of course, you could probably do it with GetElementById() instead.

> these all give me errors -- what am i doing wrong?
>
> for navigator i'm going to have to use something like
>
>    document.images['foo'].x

Hehe.  You're best off wrapping the images within links and using those
links to capture the mouse position, unless you know where the menus are
at all times.


-- 
Ben Henick
Web Author At-Large              Managing Editor
http://www.io.com/persist1/      http://www.digital-web.com/
persist1 at io.com                  bmh at digital-web.com
--
"Are you pondering what I'm pondering, Pinky?"
"I think so, Brain, but... (snort) no, no, it's too stupid."
"We will disguise ourselves as a cow."
"Oh!" (giggles) "That was it exactly!"





More information about the thelist mailing list