View Full Version : get image top/left absolute position in IE ??

12-15-2004, 10:00 PM
I need to capture an image's x/y position using IE. I have the script code for FF/NS working perfectly, but I can't seem to find a way to capture the absolute position in IE.

Here's my script that works in FF/NS:

function moveleft(which)
document.getElementById(which).style.position="absolute"; document.getElementById(which).style.left=document.getElementById(which).x - 20;

<IMG src="images/blue_logo_100x100.jpg" height="100" name="bluelogo" id="bluelogo" width="100" onclick="moveleft('bluelogo');">

I've tried functions that loop through the DOM and calculate the position, but they still don't return the abs position. (here's one I tried IE abs pos (http://www.webreference.com/dhtml/diner/realpos1/7.html) to no avail)

How can I capture the abs position in IE, and why is it so *#@( tough?

12-16-2004, 03:07 AM
See if this works for you:

Finding Position (http://radio.javaranch.com/channel/pascarello/2004/12/15/1103125502000.html)