P
Paul
Hi,
I'm trying to find the left and top position of an image in MSIE. In
HTML the image is
<img border=0 src="image.png" id="myimage" style="position:relative;" /
The javascript is
///////
var myvar;
var xpos;
document.onmousemove = getCoordinate;
function getCoordinate(e) {
myvar = document.getElementById('myimage');
xpos = myvar.style.left;
displayvar(xpos); // function to display a value
}
///////
The myvar.style.left is empty. Also I've tried
xpos = myvar.style.pixelLeft
which is always set to zero regardless of the images left position.
Any ideas how to read the x,y position of an image? The above works if
the html style tag in the img tag is
style="position:relative; left:400px"
So the javascript reads the left position as 400, but I don't want to
manually fix the position of the image.
Any help is greatly appreciated.
Paul
I'm trying to find the left and top position of an image in MSIE. In
HTML the image is
<img border=0 src="image.png" id="myimage" style="position:relative;" /
The javascript is
///////
var myvar;
var xpos;
document.onmousemove = getCoordinate;
function getCoordinate(e) {
myvar = document.getElementById('myimage');
xpos = myvar.style.left;
displayvar(xpos); // function to display a value
}
///////
The myvar.style.left is empty. Also I've tried
xpos = myvar.style.pixelLeft
which is always set to zero regardless of the images left position.
Any ideas how to read the x,y position of an image? The above works if
the html style tag in the img tag is
style="position:relative; left:400px"
So the javascript reads the left position as 400, but I don't want to
manually fix the position of the image.
Any help is greatly appreciated.
Paul