<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
function addTable()
{
var insertHtml=$('#mainDiv').append($('#tmpTable').html());
}
function deleteTable(id)
{
$("#"+id).remove();
}
function appendTable()
{
var countTable=$("#countTable").val();
var tableId="table"+countTable;
var tableHtml="<table id='"+tableId+"'><tr><td>'" ;
tableHtml=tableHtml+"bbbbbbb";
tableHtml=tableHtml+"</td><td id=''><input ddd='sssss' id='sss"+tableId+"'' name='sss.table1' type='text' value='"+tableId+"'></td><td>bbbbbb</td> </tr>" +
"<tr> <td>bbbbb</td><td>bbbbb</td><td>bbbbb</td> </tr>";
tableHtml=tableHtml+"<tr><td> <input type='button' οnclick=deleteTable('"+tableId+"') value='删除'></td></tr></table>";
countTable=parseInt(countTable)+1;
$('#mainDiv').append(tableHtml);
$("#countTable").val(countTable);
}
function submitForm()
{
var getValue=$("#ssstable1").val();
var allInput=$("input[ddd='sssss']");
var allText="";
for(var i=0;i<allInput.length;i++)
{
allText=allText+allInput[i].value+" sads ";
}
alert(allText);
}
</script>
<body>
<input type="button" οnclick="addTable()" value="添加">
<input type="button" οnclick="appendTable()" value="添加table">
<input type="hidden" id="countTable" value="1">
<form action="">
<div id="mainDiv">
<table id="4234324">
<tr>
<td>aaaaaa</td>
<td>aaaaaa</td>
<td>aaaaaa</td>
</tr>
<tr>
<td>aaaaaa</td>
<td>aaaaaa</td>
<td>aaaaaa</td>
</tr>
<input type="button" οnclick="deleteTable('table1')" value="删除">
</table>
</div>
<table id="tmpTable" style="display: none">
<tr>
<td>aaaaaa</td>
<td>aaaaaa</td>
<td>aaaaaa</td>
</tr>
<tr>
<td>aaaaaa</td>
<td>aaaaaa</td>
<td>aaaaaa</td>
</tr>
<tr id="addButtonTr">
</tr>
</table>
<input id="submit" type="button" οnclick="submitForm()" value="提交">
</form>
</body>
</html>