id ¾ÖÆ®¸®ºäÆ®ÀÇ °ª¿¡ ¸Â´Â óÀ½ °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.

Àμö/ÆĶó¸ÞÅÍ
sID
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, id °ªÀ» ÁöÁ¤ÇÏ´Â ¹®ÀÚ¿­ÀÌ´Ù.
¹Ýȯ°ª

¹Ýȯ°ª oElemÀº ÁöÁ¤µÈ ¿¤·¹¸àÆ® ÀνÄÀÚ(id)À» °®´Â óÀ½ÀÇ °³Ã¼ÀÌ´Ù.

Ư±â

¸¸ÀÏ id °ªÀÌ Ä÷º¼Ç¿¡ ¼Ò¼ÓµÇ¸é,getElementById ¸Þ¼­µå´Â ±× Ä÷¹¼Ç¿¡¼­ Á¦ÀÏ Ã³À½ °³Ã¼À» ¹ÝȯÇÑ´Ù.

Àû¿ë
°³Ã¼scriptIE
ÂüÁ¶
(¿µ¹®)DOM(W3C Document Object Model)

ÀÌ ¸Þ¼­µå´Â (¿µ¾î)DOM Level 1(Document Object Model Level 1)¿¡¼­ Á¤ÀǵǾú´Ù.


À̼ø½Å
È«±æµ¿
Lincon
°á°ú Ç¥½Ãâ

getElementById ¸Þ¼­µå·Î id ¼Ó¼º°ªÀÌ id2ÀÎ ¿¤·¹¸àÆ®¸¦ ã¾Æ ³»¿ë ÅؽºÆ®¸¦ µð½ºÇ÷¹ÀÌÇÑ´Ù.

<SCRIPT>
function doShow(){
   showA.innerHTML='document.getElementsById("id2").innerText='+document.getElementById("id2").innerText;
}
</SCRIPT>
<DIV id="id1">À̼ø½Å</DIV>
<DIV id="id2">È«±æµ¿</DIV>
<DIV id="id3">Lincon</DIV>
<INPUT type="button" value="id ¾ò±â" onclick="doShow()">
<DIV id=showA>°á°ú Ç¥½Ãâ</DIV>