name ¾ÖÆ®¸®ºäÆ®ÀÇ °ª¿¡ ±âÃÊÇÏ¿© °³Ã¼µéÀÇ Ä÷º¼ÇÀ» ¹ÝȯÇÑ´Ù.

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

¹Ýȯ°ª oCollectionÀº ÁöÁ¤µÈ ¿¤·¹¸àÆ® À̸§(name)µéÀ» °®´Â °³Ã¼µéÀÇ Ä÷º¼ÇÀÌ´Ù.

Ư±â

getElementsByName ¸Þ¼­µå, ¹®¼­¿¡ ÀÖ´Â ÁöÁ¤ÇÑ name À̳ª id ¾ÖÆ®¸®ºäÆ® °ªÀ» °®´Â ¸ðµç ¿¤·¹¸àÆ®¸¦ ¹ÝȯÇÑ´Ù.

name°ú id ¾ÖÆ®¸®ºäÆ®¸¦ Áö¿øÇÏ´Â ¿¤·¹¸àÆ®´Â getElementsByName ¸Þ¼­µå¿¡ ÀÇÇÏ¿© ¹ÝȯµÈ Ä÷º¼Ç¿¡ Æ÷ÇÔµÇÁö¸¸, expando name ¿¤·¹¸àÆ®´Â Æ÷ÇÔµÇÁö ¾Ê´Â´Ù.

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

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


name DIV

°á°ú Ç¥½Ãâ

getElementsByName ¸Þ¼­µå¸¦ »ç¿ëÇÏ¿© nameÀÌ 'name' ÀÎ °³Ã¼µéÀÇ Ä÷º¼ÇÀ» ¹ÝȯÇÑ´Ù. id°¡ 'name' ÀÎ °³Ã¼°¡ Æ÷ÇԵȴÙ.

<SCRIPT>
function getNames(nb){
   var aInput=document.getElementsByName('name');
   showA.innerHTML=aInput[nb].value+'<BR>';
   showA.innerHTML+='document.getElementsByName("name").length='+document.getElementsByName("name").length;
}
</SCRIPT>
<DIV id="name" style="border:solid 1 blue;width:600">name DIV</DIV>
<INPUT type="text" name="name" value="À̼ø½Å">
<INPUT type="text" name="name" value="È«±æµ¿">
<INPUT type="text" name="name" value="Lincon"><BR>
<INPUT type="button" value="À̸§ #0 ¾ò±â" onclick="getNames(0)">
<INPUT type="button" value="À̸§ #1 ¾ò±â" onclick="getNames(1)">
<INPUT type="button" value="À̸§ #2 ¾ò±â" onclick="getNames(2)">
<INPUT type="button" value="À̸§ #3 ¾ò±â" onclick="getNames(3)">
<DIV id=showA>°á°ú Ç¥½Ãâ</DIV>