JavaScript Reference/Javascript Objects/TextRectangle

Материал из Web эксперт
Перейти к: навигация, поиск

"TextRectangle" Example

   <source lang="javascript">
   

<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>

Click here to display the TextRectangle properties

</body> </html>


     </source>
   
  


"TextRectangle" JavaScript Properties

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | JavaScript |bottom left | | Properties |right top | +----------------+--------------------------------------------------------------+

     </source>
   
  


"TextRectangle" Syntax and Note

   <source lang="javascript">

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


     </source>