<body>
<input type="button" value="test" onclick="javascript:a();">
<table id="tab">
<tr>
<td>1</td>
<td><input name="11" type="text" value="11"/></td>
</tr>
</table>
<script type="text/javascript">
var s = 2;
function a (){
var tr=document.createElement("tr");
var td1=document.createElement("td");
var td2=document.createElement("td");
var input=document.createElement("input");
input.type="text";
input.value=s+""+s;
input.name=s+""+s;
var tbody = document.getElementById("tab").getElementsByTagName("tbody")[0];
td1.innerHTML = ""+s;
td2.appendChild(input);
tr.appendChild(td1);
tr.appendChild(td2);
tbody.appendChild(tr);
s++;
}
</script>
</body>