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

David Lovering dlovering at gazos.com
Wed Apr 9 15:16:13 CDT 2003


Finally!  A question I can answer without blushing...

document.all.image1.bottom
document.all.image1.height
document.all.image1.left
document.all.image1.maxHeight
document.all.image1.maxWidth
document.all.image1.minHeight
document.all.image1.minWidth
document.all.image1.position    (static, relative, absolute, fixed, or
inherit)
document.all.image1.Right
document.all.image1.Top
document.all.image1.verticalAlign
document.all.image1.Width
document.all.image1.zIndex

All but the last attribute and position are either a length value,
percentage, or symbolic value.  The symbolic values which generally port are
{inherit, auto, none}.  The zIndex is either a layer number (zIndex) or else
{auto, inherit}.

Which ones are actually used depends a lot on the web-page, which browser
you are using, and whether or not the
frame/window geometry is fixed or resizeable.  Try them all!  Show your
friends!

-- Dave Lovering

----- Original Message -----
From: "DEV" <dev at qroute.net>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Wednesday, April 09, 2003 2:03 PM
Subject: [Javascript] Getting the X,Y coordinates of an image


> If I have an image like this
> <img id=image1 src='anImage.gif'>
>
> How do I get the top / left properties of that image relative to the
browser
> ?
>
> is there something like this such as
> alert(document.all.image1.top.value) ???
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>




More information about the Javascript mailing list