Click to return to the DHTML, HTML     
REV Attribute | rev Prope...     right Attribute | right P...     DHTML Properties    
Web Workshop  |  DHTML, HTML & CSS

right Property


Retrieves the right coordinate of the rectangle surrounding the object content.

Syntax

HTMLN/A
Scripting[ iCoord = ] oTextRectangle.right

Possible Values

iCoordInteger that specifies the right coordinate of the rectangle, in pixels.

The property is read-only with no default value.

Remarks

To access the right coordinate of the second text rectangle of a TextRange object, use this syntax:

oRct = oTextRange.getClientRects();
oRct[1].right;

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

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

oBndRct = oElement.getBoundingClientRect();
oBndRct.right;

Example

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

Sample Code

<SCRIPT>
function getCoords(oObject) {
    oBndRct=oObject.getBoundingClientRect();
    alert("Bounding rectangle = \nUpper left coordinates: "
        + oBndRct.left + " " + oBndRct.top +
        "\nLower right coordinates: "
        + oBndRct.right + " " + oBndRct.bottom);
}
</SCRIPT>
</HEAD>
<BODY>
<P ID=oPara onclick="getCoords(this)">
This feature requires Internet Explorer 5 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
TextRectangle

See Also

TextRectangle Collection, TextRectangle Object, bottom, left, top



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.