°³Ã¼ÀÇ ÁÖÀ§¿¡ °¨½Î´Â ¹Ù´Ú »ç°¢Çü ÁÂÇ¥(Á¦ÀÏ À§¿¡¼ ºÎÅÍÀÇ °Å¸®)¸¦ Çȼ¿´ÜÀ§·Î ¹ÝȯÇϰųª ÁöÁ¤ÇÑ´Ù.
ÀÌ ¼Ó¼ºÀº Àбâ/¾²±âÀÌ¸ç µðÆúÆ®°ªÀº ¾ø´Ù.
TextRange °³Ã¼ »ç°¢ÇüÀÇ ¾Æ·¡ÂÊ ÁÂÇ¥¸¦ ¾òÀ¸·Á¸é TextRangesÀ» »ç¿ëÇÏ¿©
RctCol=TextRangeObj.getClientRects(); RctCol[index].bottom;
¹ÀÎ(bound) ¿¤·¹¸àÆ®ÀÇ ¹ÝÇ⠻簢ÇüÀÇ ¾Æ·¡ÂÊ ÁÂÇ¥¸¦ ¾òÀ¸·Á¸é boundElementsÀ» »ç¿ëÇÏ¿©
BndRctCo=elementObj.getBoundingClientRect(); BndRctCol(index).bottom;
µÎ °æ¿ì ¸ðµÎ Ä÷º¼Ç¿¡¼ ¹è¿º¯¼öÀÇ Àμö·Î È£ÃâÇϹǷΠóÀ½ °ÍÀÌ index 0, µÎ¹ø°°¡ 1 ½ÄÀ¸·Î µÈ´Ù.
°³Ã¼ | script | HTML | ±Ô°Ý | IE |
---|
ÀÌ ¼Ó¼ºÀº CSS Level 2(Cascading Style Sheets)¿¡¼ Á¤ÀǵǾú´Ù.
Å©¸¯ÇØ º¸¶ó.
<SCRIPT> function getPos(obj) { rectObj=obj.getBoundingClientRect(); str='Bounding rectangle<BR>¿ÞÂÊ ¸ÇÀ§ ÁÂÇ¥ ('+rectObj.left+', '+rectObj.top+')<BR>'; str+='¹Ù´Ú ¿À¸¥ÂÊ ÁÂÇ¥ ('+rectObj.right+', <FONT color=red>'+rectObj.bottom+'</FONT>)'; show.innerHTML=str; } </SCRIPT> <P onclick="getPos(this)" style="border:solid 1 green;text-align:center;background:#ffa">Å©¸¯ÇØ º¸¶ó.</P> <DIV id=show> </DIV>