'removechild'에 해당되는 글 1건

  1. 2009.01.20 javascript appendChild 와 removeChild
posted by 준치 2009. 1. 20. 10:13

<script type="text/javascript">

function add(){
   var oText = document.createElement("input");
   oText.setAttribute("type", "text");
   oText.setAttribute("id", "txt");
   document.myform.appendChild(oText);
}
function del(){
   var oText = document.getElementById("txt");
   oText.parentNode.removeChild(oText);
}
</script>