87,992
社区成员
发帖
与我相关
我的任务
分享<!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>
<title></title>
<script src="../Js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#Button1").click(function () {
$("#table2").html($("#table1").html())
})
})
</script>
</head>
<body>
<table id="table1" class="tableTemp" cellpadding="2px" cellspacing="0" style="border-collapse: collapse"
border="1px" bordercolor="#CCCCCC">
<tbody>
<tr>
<th>
测试下拉框
</th>
<th>
测试文本框
</th>
</tr>
<tr>
<td>
<select class="input">
<option value="是">是</option>
<option value="否">否</option>
</select>
</td>
<td>
<input class="input" type="text">
</td>
</tr>
</tbody>
</table>
<br />
<br />
<table id="table2" class="tableTemp" cellpadding="2px" cellspacing="0" style="border-collapse: collapse"
border="1px" bordercolor="#CCCCCC">
</table>
<input id="Button1" type="button" value="button" />
</body>
</html>
if($.browser.msie){
$("#table2").html($("#table1").html())
}else{
var _backup = $("#table1").clone();
_backup.find('select').children().each(function(index){
if($(this).val()==$("#table1").find('select').val()){
this.setAttribute('selected' , true);
}
});
$("#table2").html(_backup);
}

if($.browser.msie){
$("#table2").html($("#table1").html())
}else{
var _backup = $("#table1").clone();
_backup.find('select').val($("#table1").find('select').val());
$("#table2").html(_backup)
}
$("#table2").html($("#table1").clone())