top Property

Internet Development Index

Sets or retrieves the top coordinate of the rectangle surrounding the object content.

Syntax [ = iCoord ]

Possible Values

iCoordInteger that specifies or receives the top coordinate of the rectangle, in pixels.

The property is read/write. The property has no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.


Use this syntax to access the top coordinate of the second text rectangle of a TextRange object:

oRct = oTextRange.getClientRects();

Note that the collection index starts at 0, so the second item index is 1.

To access the top coordinate of the bounding rectangle of an object, use this syntax:

oBndRct = oElement.getBoundingClientRect();;


This example uses the getBoundingClientRect method to retrieve the coordinates of the bounds of the text rectangles within the element.

function getCoords(oObject) {
alert("Bounding rectangle = \nUpper left coordinates: "
+ oBndRct.left + " " + +
"\nLower right coordinates: "
+ oBndRct.right + " " + oBndRct.bottom);
<P ID=oPara onclick="getCoords(this)">

Standards Information

There is no public standard that applies to this property.

Applies To


See Also

bottom, left, right, TextRectangle Collection, TextRectangle Object