如题,用js写的.

解决方案 »

  1.   

     protected void Page_Load(object sender, EventArgs e)
        {
            string str = "";
            for (int i = 0; i < 5; i++)
            {
                str += "<input id='Text" + i.ToString() + " type='text' />";
            }
            Response.Write(str.ToString());
        }
      

  2.   

    function aa()
    {
    var d = document.all.tags("input");
    var v = new Array();
    for(var i=0;i < d.length;i++)
    {
    if(d[i].type.toString() == "text")
    {
    v[i] = d[i];
    }
    }
    var n = v.length + 1; //这个n就是你下一个type="text"的第几个了
    }
      

  3.   

    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script type="text/javascript">
    <!--
    function addInput()
    {
    var i = document.getElementById("i").value;
    document.getElementById("i").value++;
    var zone = document.getElementById("zone");

    var input = document.createElement("input");
    input.id = i;
    input.name = i;
    input.type = "text";
    alert("<input id="+i+" name="+i+" type=text />");

    zone.appendChild(input);
    }
    //-->
    </script>
    </head><body>
    <input name="add" type="button" id="add" value="添加" onclick="addInput();" />
    <input id="i" type="hidden" value="0" />
    <div id="zone"></div>
    </body>
    </html>
      

  4.   

    4楼正解,可以用createElement动态添加!