document.getElementById("sadsd").removeNode(true)

解决方案 »

  1.   

    document.getElementById("sadsd").removeNode(true)
    如果是多加几个就不可以了,我的只可以删除一个,
      

  2.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <title>WebForm2</title>
    <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    <script language="javascript">
    var i=0;
    function ContinueUpLoad()
    {
    var str = '<div id=div'+i+'><INPUT id=file'+i+' type=file size=50 NAME=File><input id =btn'+i+' type =button value=删除 onclick =delFile("div'+i+'")></div>'
       document.getElementById('MyFile').insertAdjacentHTML("beforeEnd",str);
    }
    function delFile(diva)
    {

    document.getElementById(diva).parentNode.removeChild(document.getElementById(diva))

    } </script>
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server" enctype="multipart/form-data">
    <div>
    <table>
    <tr>
    <td id="tdRrmove" width="80">
    <div id="MyFile"><FONT face="宋体"></FONT>
    </div>
    </td>
    </tr>
    </table>
    </div>
    <INPUT type="button" value="添加附件" onclick="ContinueUpLoad()">
    <asp:Button id="UploadButton" runat="server" Text="Button"></asp:Button>
    <asp:Label id="strStatus" runat="server">Label</asp:Label>
    </form>
    </body>
    </HTML>