[Javascript] Getting the X,Y coordinates of an image

Andrew Gibson andyg at ihug.co.nz
Thu Apr 10 02:08:07 CDT 2003


Yep, you probably tried

document.images[0].style.top

but that will give you nothing, it will only work if you've set it first.

.offsetTop etc are read only values so you cant change them, but you can
change with style.top=x

Works with IE anyway@

Cheers
Andrew

===================================================
Subject: Re: [Javascript] Getting the X,Y coordinates of an image


Well,, document.images[0].offsetLeft just  did the job right ? Is the Left
and offsetLeft gives me the same value ?






More information about the Javascript mailing list