有两种方法:
1.每列都使用同样的Name属性,如果有多列,在服务器端就接收信息就会是一个数组
2.使用一个隐藏表单来储存新增加的字段名,到服务器端根据这个来读取数据。推荐使用第1种方法

解决方案 »

  1.   

    to GageCSDN(稻草人) 
    1.每列都使用同样的Name属性,如果有多列,在服务器端就接收信息就会是一个数组   能不能说得再详细一些或者给实例。
       新手上路,请多关照:)
       thx!
      

  2.   

    response.write(request("name"))输出一下,你就知道什么是数组了
      

  3.   

    我这里写了一个例子,可供你参考一下,为了方便,我把HTML和ASP都写在一个文件里了。
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>表格编辑</title>
    <style>
    td {font-size:12px;height:16px;}
    th {font-size:12px;height:18px;}
    a:hover      { text-decoration: underline; font-size: 12px; color:red; }
    a      { text-decoration: none; font-size: 12px; }
    span {font-size:12px;height:13px;}
    input {font-size:12px;height:13px;}
    </style>
    <script language="JavaScript">
    var Focus_Obj = null;
    function addLine()
    {
    myTbl.insertRow();
    var tmpTR = myTbl.rows[myTbl.rows.length-1];
    tmpTR.insertCell();
    tmpTR.cells[0].innerHTML = "<input type=\"text\" name=\"FieldOne\" onchange=\"this.nextSibling.innerText=this.value;\" style=\"width:100%;border: 0 none;display:none;\"><span></span>";
    tmpTR.cells[0].onclick = new Function("TD_Click(this);");
    tmpTR.insertCell();
    tmpTR.cells[1].innerHTML = "<input type=\"text\" name=\"FieldTwo\" onchange=\"this.nextSibling.innerText=this.value;\" style=\"width:100%;border: 0 none;display:none;\"><span></span>";
    tmpTR.cells[1].onclick = new Function("TD_Click(this);");
    tmpTR.insertCell();
    tmpTR.cells[2].innerHTML = "<input type=\"text\" name=\"FieldThree\" onchange=\"this.nextSibling.innerText=this.value;\" style=\"width:100%;border: 0 none;display:none;\"><span></span>";
    tmpTR.cells[2].onclick = new Function("TD_Click(this);");
    tmpTR.insertCell();
    tmpTR.cells[3].align = "center";
    tmpTR.cells[3].innerHTML = "<a href=\"#\" onclick=\"delRow(this.parentElement.parentElement);\">删除</a>";
    }function delRow(row)
    {
    if(confirm("确认要删除这行吗?"))
    myTbl.deleteRow(row.rowIndex);
    }function TD_Click(obj)
    {
    if(Focus_Obj == obj) return false;
    if(Focus_Obj)
    {
    Focus_Obj.children[0].style.display = "none";
    Focus_Obj.children[1].style.display = "";
    }

    if(obj.tagName == "TD")
    {
    obj.children[0].style.display = "";
    obj.children[1].style.display = "none";
    obj.children[0].readonly = false;
    obj.children[0].select();
    Focus_Obj = obj;
    }}
    </script>
    </head><body>
    <form action="" method="POST">
    <TABLE bgcolor="#6699FF" border="0" cellspacing="1" cellpadding="0" width="100%" id="myTbl">
    <TBODY bgColor="#FFFFFF">
    <TR bgColor="#99CCFF">
    <TH>字段一</TH>
    <TH>字段二</TH>
    <TH>字段三</TH>
    <TH align="center">操作</TH>
    </TR>
    </TBODY>
    </TABLE>
    <table width="100%"><tr><td align="center"><input style="height:22px;" type="button" value="添加行" onclick="addLine();"> <input style="height:22px;" type="submit" name="UpLoad" value="提交数据"></td></tr></table>
    </form>
    </body>
    <%
    If Request.Form("UpLoad") <> "" Then
    DataCount = Request.Form("FieldOne").count Response.Write "您提交了" & DataCount & "条记录,它们是:<br>" For i = 1 To DataCount
    FieldOne = Request.Form("FieldOne")(i)
    FieldTwo = Request.Form("FieldTwo")(i)
    FieldThree = Request.Form("FieldThree")(i)

    Response.Write i & ".[" & FieldOne & "]&nbsp;&nbsp;&nbsp;[" & FieldTwo & "]&nbsp;&nbsp;&nbsp;[" & FieldThree & "]<br>"
    Next
    End If
    %>
    </html>