i=0;
textstr="<input type=text name=text"+(i++)+">";

解决方案 »

  1.   

    一个控件都可以有id和name,还可以动态改变它的ID
      

  2.   

    <html>
    <script>
    function add(id)
    {
    var str="<span><table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"676\"><tr><td><input type=text name=t value=\"值\"></td></tr></table></span>";
    eval(id).outerHTML=eval(id).outerHTML+str;}</script>
    <head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>新建网页 1</title>
    </head><body>
    <span>
    <table id=ta1 border="1" width="676" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0">
      <tr>
        <td width="38"> </td>
        <td width="635"> </td>
      </tr>
      <tr>
        <td width="38"> </td>
        <td width="635"> </td>
      </tr>
      </table>
      </span>
      <input type=button name=add value=add onclick="add('ta1')"></body></html>
      

  3.   

    如何在asp中调用倒是一个问题?
      

  4.   

    <div id=a></div><input type=button onclick="for(i=1;i<21;i++) {a.innerHTML+='<input name=\'b'+i+'\' value=\'b'+i+'\'>';;}">