개발하자/자바스크립트
createElement, appendChild
i구야
2015. 2. 26. 11:57
<html>
<head>
<script>
window.onload=function(){
b.onclick=function(){
var fontTag=document.createElement("font");
fontTag.color="blue";
fontTag.innerHTML="bbb";
bodyTag.appendChild(fontTag);
}
}
</script>
</head>
<body id="bodyTag">
<font color="red">aaa</font>
<input type="button" id="b">
</body>
</html>