<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/
javascript" src="js/jquery-1.7.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//动态内容添加
$('#addTable').click(function(){
var value = '<div id="div">'+$('#div').html()+'</div>';
$('#div').after(value);
});
//获取所有DIV中的所有INPUT和select标签对象
$('#addPro').click(function(){
$('body div[id=div]').each(function(){
$(":text,:selected",this).each(function(){
var id = $(this).attr('id');
var value = $(this).val();
var tagName = $(this).get(0).tagName;
if(tagName=='INPUT'&&id!=undefined){
alert(id+":"+value);
}
if(tagName=='OPTION'){
//要获得select的ID ,就要取得
var key = $(this).html();
alert(key);
}
});
});
});
});
</script>
</head>
<body>
<div id="div">
<table>
<tr>
<td>一个</td>
</tr>
<tr><td>
<select id="ddd">
<option value="china">中国</option>
<option value="us">美国</option>
</select></td></tr>
<tr><td>
<input id="userID" type="text"/></td></tr>
<tr><td>
<input id="userID1" type="text"/></td></tr>
</table>
</div>
<div>
<input type="button" id="addTable" value ="增加表格" />
</div>
<div>
<input type="button" id="addPro" value ="提交数据表格" />
</div>
</body>
</html>