JavaScript Reference/Javascript Objects/TextRectangle
"TextRectangle" Example
<html>
<head>
<script language="JavaScript">
function function1(elem) {
var m = elem.getBoundingClientRect();
alert("Left: "+ m.left +"\nRight: "+ m.right +"\nTop: "+m.top+"\nBottom:"+m.bottom);
}
/script>
</head>
<body>
<div onClick="function1(this);"
style="background-color:black; color:white; width:300; height:100;">
Click here to display the TextRectangle properties
</div>
</body>
</html>
"TextRectangle" JavaScript Properties
+----------------+--------------------------------------------------------------+
| JavaScript |bottom left |
| Properties |right top |
+----------------+--------------------------------------------------------------+
"TextRectangle" Syntax and Note
Note:
Access to the container rectangle of the text.
To create this object, you must use the getClientRects() or
getBoundingClientRect() method.
Syntax:
textRectangleName = document.all.elementID.getClientRects()
textRectangleName = document.all.elementID.getBoundingClientRect()
textRectangleName.memberName