<%@ Page Language="C#" AutoEventWireup="true" CodeFile="xmbuzhou.aspx.cs" Inherits="详细信息" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"><title></title>
<script type="text/javascript" language="javascript">
  function addFj()
  {
      var oTb = document.getElementById("tb1");
      var oTr = oTb.insertRow(0);
      var name = "thefilename"+document.form1.fjCnt.value;
      document.form1.fjCnt.value=parseInt(document.form1.fjCnt.value)+1;
      oTr.insertCell(0).innerHTML = "<table cellSpacing='0' cellPadding='0' width='100%' align='center'><tr bgColor='#ffffff' align='center'><td><input id='file' name='"+name+"' type=text style='width:400px;'></td><td > <input type=button onclick='return delFj(this)' value='删除'></td></tr></table>"
      return false;
  }
  function delFj(obj)
  {
      obj.parentElement.parentElement.removeNode(true);
      return false;
  }
  
  
    </script><link href="stylesheets/global.css" rel="stylesheet" type="text/css" /><link href="stylesheets/merchant.css" rel="stylesheet" type="text/css" /><link href="sky/Style.css" type="text/css" rel="Stylesheet">
    <script type="text/javascript">
        function closeBox() {
            self.parent.tb_remove();
        }
    </script>
</head>
<body>
 <form id="form1" method="post" runat=server>    <table width="500" border="0" align="center" cellspacing="0" style="border: solid 1px #99c2ee; height: 50px;">
        <tr>
            <td height="29" bgcolor="#F1F1F1" class="pad10_lef sf_t font14" style="text-align: right; background-image: url(cb_banner.jpg); background-repeat: repeat-x;">
                <span style="float: left; color: #133A6F;"><strong>项目细分步骤</strong></span> <a href="javascript:void(0);" onclick="closeBox();" style="padding-right: 10px; color: #999999; font-size: 12px;">关闭</a>
            </td>
        </tr>
        <tr>
            <td height="200" colspan="2" align="center" valign=top>
                <table width="500" align="center"><tr>
               
                <td style="height: 21px" colspan="2">
               <table id="tb1" border="0">
   
             </table>
        <input type="hidden" name="fjCnt" value="1" />
       
                <br />
                    
        <a href="#" onclick="return addFj()" class="bt_mouseout">添加项目步骤</a><asp:Button ID="Button1" class="bt_mouseout" runat="server" Text="保存步骤" OnClick="Button1_Click" /></td>
            </tr></table>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>

解决方案 »

  1.   

    asp。net页面提交时是post的,所以得用Request.Forms["控件name"]
      

  2.   

    用js 生成的一般都是html控件,而html控件在cs文件中是不能直接获取它的值得,不过用两种方式可以处理
    1、将这些text的值放在一个隐藏控件中,提交后,在隐藏控件中获取这些值。
    2、第二种就是采用ajax来提交数据。
      

  3.   


    我的是INPUT控件,也可以直接获取吗?能否详细写一下呢
      

  4.   

    [Quote=引用 5 楼 hnllijian123456 的回复:]
    引用 3 楼 thedolphin 的回复:
    asp。net页面提交时是post的,所以得用Request.Forms["控件name"]我要循环读取text里的值一条一条插入到数据库,改怎么弄,我现在后台是这样写的  string title = Request.Form["fjCnt"].ToString();
      

  5.   

    循环读取数据,组成一个JSON的数组,到后台得到JSON以后,对JSON数据处理
      

  6.   

    原始的web开发是从一个页面的form提交到一个处理页面进行处理,你动态创建的input只不过是提交到了本页,当然合一用request.forms[]来获取了,但是前提是,你创建的input再form里面,而不是外面,
      

  7.   

    二楼的可以,LZ不要忘了JS生成的text要带有name属性,如果不是就拿不到了,而且text必须在form里面