[thelist] Quick JS question - x and y position of an image

Jason Handby jasonh at pavilion.co.uk
Thu Jan 23 09:12:58 CST 2003

Hi all,

In Javascript, how can I find the x and y position of an image in a
document? I want to do this so that I can have a floating layer appear below
it as a rollover action, i.e. something like

	var myLayer = document.getElementById('my_layer');
	myLayer.style.left = x_coordinate_of_image;
	myLayer.style.top = y_coordinate_of_image + 50;
	myLayer.style.visibility = "visible";

It looks like I can use offsetHeight and offsetLeft to do what I want in
Internet Explorer, but how do I do it in Netscape?


More information about the thelist mailing list