This topic has not yet been rated - Rate this topic

left property

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

Syntax

JavaScript

p = object.left

Property values

Type: Integer

the left coordinate of the rectangle, in pixels.

Remarks

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


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

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

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


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

Examples

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

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/rectangles.htm


<SCRIPT>
function getCoords(oObject) {
    oBndRct=oObject.getBoundingClientRect();
    alert("Bounding rectangle = \nUpperleft coordinates: "
        + oBndRct.left + " " + oBndRct.top +
        "\nLowerright coordinates: "
        + oBndRct.right + " " + oBndRct.bottom);
}
</SCRIPT>
</HEAD>	
<BODY>
<P ID=oPara onclick="getCoords(this)">

See also

TextRectangle Constructor
Reference
bottom
right
top
TextRectangle

 

 

Send comments about this topic to Microsoft

Build date: 2/14/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ