<HEAD>
<SCRIPT>
function removeElement()
{ //The first child of the div is the bold element.
var oChild=Div1.children(0);
Div1.removeChild(oChild);}
</SCRIPT>
</HEAD>
<BODY>
<DIV ID='Div1' >
<input type="text" value="aa"/></DIV>
<input type="button" onclick="removeElement()" value="删除"/>
</BODY>

解决方案 »

  1.   

    <HEAD>
    <SCRIPT>
    function removeElement()
    { //The first child of the div is the bold element.
    var oChild=form1.children(0);
    form1.removeChild(oChild);}
    </SCRIPT>
    </HEAD>
    <BODY><FORM METHOD=POST ACTION="" id="form1" id="form1">
    <input type="text" value="aa"/><input type="button" onclick="removeElement()" value="删除"/>
    </FORM></BODY>
      

  2.   

    还是这个好,可以根据ID来删除.
    <HEAD>
    <SCRIPT>
    function removeElement()
    {//The first child of the div is the bold element.
    var oChild=form1.children('txt1');
    if (oChild != null)
    {
    form1.removeChild(oChild);
    }}
    </SCRIPT>
    </HEAD>
    <BODY><FORM METHOD=POST ACTION="" id="form1" id="form1">
    <input type="text" value="aa" id="txt1"/><input type="button" onclick="removeElement()" value="删除"/>
    </FORM></BODY>
      

  3.   

    <body>
    <input type="button" onclick="this.removeNode(true)" value="删除"/>
    </body>
      

  4.   

    var p=document.all.file
      p.removeChild(p);
      

  5.   

    错了应该是
      var p=document.all.file
      p.parentNode.removeChild(p);