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.onmous emove = getCoordinate;
function getCoordinate(e ) {
myvar = document.getEle mentById('myima ge');
xpos = myvar.style.lef t;
displayvar(xpos ); // function to display a value
}
///////
The myvar.style.lef t is empty. Also I've tried
xpos = myvar.style.pix elLeft
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;" /
>
///////
var myvar;
var xpos;
document.onmous emove = getCoordinate;
function getCoordinate(e ) {
myvar = document.getEle mentById('myima ge');
xpos = myvar.style.lef t;
displayvar(xpos ); // function to display a value
}
///////
The myvar.style.lef t is empty. Also I've tried
xpos = myvar.style.pix elLeft
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
Comment