how do you reference the absolute location of an item in IE?

by Ed Lazor <osmosis(at)atfantasy.com>

 Date:  Wed, 22 Nov 2000 15:06:01 -0800
 To:  hwg-style(at)hwg.org
  todo: View Thread, Original
Hi =)

I'm trying to reference an image's x,y coordinates on a web page using 
Javascript.  So far, I've been able to retrieve correct x,y coordinates 
using the scripts listed below as long as the image isn't inside of a 
table.  Once I put the image inside a table, the coordinates retrieved are 
correct for Netscape, but incorrect for Internet Explorer.  Instead, 
Internet Explorer retrieves x,y coordinates relative to the table's 
location.  I can add the table's location to the results, but this becomes 
fairly complicated if I start nesting tables.  End result, I'm hoping 
someone knows how to reference the absolute location of the image, instead 
of it's relative position in Internet Explorer.

Thanks in advance for any help you might be able to provide =)

-Ed


function onSS(y)
{
	k="MyImage";
	d=document;
	if(NS4)
	{
		return ( (y?d.images[k].y:d.images[k].x) - (y?1:4) );
	}
	else {
		return (y?d.all(k).offsetTop:d.all(k).offsetLeft);
	}
}



note:  this source code is a modified for testing purposes and is 
originally from HierMenus at 
http://www.webreference.com/dhtml/hiermenus/index.html

HWG hwg-style mailing list archives, maintained by Webmasters @ IWA