개체에 자식 엘레멘트를 첨부한다.

Script[oVal=]object.appendChild(oNode)
인수/파라메터
oNode
필수적인 요소이며, 첨부되는 엘레멘트를 지정하는 개체이다.
반환값

첨부된 자식 엘레멘트를 참조하는 개체를 반환한다.

특기

appendChild 메서드는 엘레멘트를 childNodes 컬렉션 제일 뒤에 첨부한다.

이 메서드는 IE6.0에서 attribute 개체에도 적용된다.

페이지에 새로운 엘레멘트를 디스플레이하기 위해서는 body 엘레멘트 속에 자식으로 첨부하여야 한다. 예를들어 bodydiv 엘레멘트를 첨부하기 위해서는

var oDiv=document.createElement('DIV');
document.body.appendChild(oDiv);

이 메서드는 런타임(run time)에 접속할 수 있다. 런타임에서 이 엘레멘트가 종료태그가 파싱되기 전에 제거되면, 문서의 지역들은 표현되지 않을 수 있다.

적용
개체scriptIE
aa.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
acronymacronym.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
addressaddress.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
attributeattribute.appendChild(oNode)IE6(win32)
bb.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
bdobdo.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
bigbig.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
blockQuoteblockQuote.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
bodybody.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
buttonbutton.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
captioncaption.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
centercenter.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
citecite.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
codecode.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
colcol.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
colGroupcolGroup.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
commentcomment.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
dddd.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
deldel.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
dfndfn.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
dirdir.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
divdiv.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
dldl.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
dtdt.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
emem.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
fieldSetfieldSet.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
fontfont.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
formform.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
frameSetframeSet.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
headhead.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
hnhn.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
htmlhtml.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
ii.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
iFrameiFrame.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
buttonbutton.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
checkboxcheckbox.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
FileUploadFileUpload.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
imageimage.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
passwordpassword.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
radioradio.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
resetreset.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
submitsubmit.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
texttext.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
insins.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
kbdkbd.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
labellabel.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
legendlegend.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
lili.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
listinglisting.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
mapmap.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
marqueemarquee.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
menumenu.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
nextIDnextID.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
olol.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
OptionOption.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
pp.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
plainTextplainText.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
prepre.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
qq.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
ss.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
sampsamp.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
smallsmall.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
spanspan.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
strikestrike.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
strongstrong.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
subsub.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
supsup.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
tabletable.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
tBodytBody.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
tdtd.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
textAreatextArea.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
tFoottFoot.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
thth.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
tHeadtHead.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
trtr.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
tttt.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
uu.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
ulul.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
varvar.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
xmpxmp.appendChild(oNode)IE5(win16,win32,unix,mac),IE5.5(ce)
참조
cloneNode insertBefore (영문)DOM(W3C Document Object Model)

이 메서드는 (영문)DOM1(W3C Document Object Model Level 1)에서 정의되었다.


method
appendChild 메서드
appendChild</b> 메서드이전페이지로페이지 맨위로페이지 맨아래로

appendChild 메서드로 목록 항목들 총 6개까지 첨부한다.

<SCRIPT>
function appChild(){
  if (oList.all.length<6){
    var oNewNode=document.createElement('LI');
    oList.appendChild(oNewNode);
    oNewNode.innerText='항목 번호 '+oList.all.length;
  }
}
</SCRIPT>
<UL id=oList>
<LI>항목 번호  1
<LI>항목 번호  2
</UL>
<INPUT type="button" value="자식 개체 추가" onclick="appChild()">
method
appendChild 메서드
견본
이전페이지로페이지 맨위로
최종 수정:
05/25/2025 09:52:04
KoXo Homepage
All right reserved
비정상적인 방식으로 프레임없이 페이지에 접속하면 자주 오류가 발생됩니다.
오류가 나면 정상적 접속으로 시도해 보세요.
http://koxo.com/lang/js/method/appendChild.html