°³Ã¼ÀÇ ÁÖÀ§¿¡ °¨½Î´Â ¸ÇÀ§ »ç°¢Çü ÁÂÇ¥(¸Ç À§¿¡¼ ºÎÅÍÀÇ °Å¸®)¸¦ Çȼ¿´ÜÀ§·Î ¹ÝȯÇϰųª ÁöÁ¤ÇÑ´Ù.
ÀÌ ¼Ó¼ºÀº Àбâ/¾²±âÀÌ¸ç µðÆúÆ®°ªÀº ¾ø´Ù.
TextRange °³Ã¼ »ç°¢ÇüÀÇ À§ÂÊ ÁÂÇ¥¸¦ ¾òÀ¸·Á¸é TextRangesÀ» »ç¿ëÇÏ¿©
RctCol=TextRangeObj.getClientRects(); RctCol[index].top;
¹ÀÎ(bound) ¿¤·¹¸àÆ®ÀÇ ¹ÝÇ⠻簢ÇüÀÇ À§ÂÊ ÁÂÇ¥¸¦ ¾òÀ¸·Á¸é boundElementsÀ» »ç¿ëÇÏ¿©
BndRctCo=elementObj.getBoundingClientRect(); BndRctCol(index).top;
µÎ °æ¿ì ¸ðµÎ Ä÷º¼Ç¿¡¼ ¹è¿º¯¼öÀÇ Àμö·Î È£ÃâÇϹǷΠóÀ½ °ÍÀÌ index 0, µÎ¹ø°°¡ 1 ½ÄÀ¸·Î µÈ´Ù.
°³Ã¼ | script | HTML | ±Ô°Ý | IE |
---|
Å©¸¯ÇØ º¸¶ó.
<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>