boundingTop property

Retrieves the distance between the top edge of the rectangle that bounds the TextRange object and the top side of the object that contains the TextRange.

Syntax

JavaScript

p = object.boundingTop

Property values

Type: Integer

the top coordinate of the bounding rectangle, in pixels.

Remarks

Note  If the TextRange is inside a textArea object, add the value of the element's scrollTop property to the value of boundingTop.

Examples

This example retrieves the value of the boundingTop property for the given text area.


<!DOCTYPE html>

<html>
<head>
  <title>boundingTop</title>
</head>
<body>
  <textarea cols="100" rows="2" onclick="boundDim(this)"> . . . </textarea>
  <script>
    function boundDim(oObject) {
      var oTextRange = oObject.createTextRange();
      if (oTextRange != null) {
        console.log("The bounding top is " + oTextRange.boundingTop + oObject.scrollTop);
      }
    }
  </script>
</body>
</html>

See also

TextRange
Reference
boundingHeight
boundingLeft
boundingWidth

 

 

Show:
© 2014 Microsoft