87,922
社区成员
发帖
与我相关
我的任务
分享
首先拿到你的tr对象,
然后
var newTr = tr.cloneNode(true);
最后把你的这个 newTr追加到table中
<!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="../jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$("#t1").addClass("C1");
$("#t2").addClass("C3");
})
</script>
<style type="text/css">
.C1
{
background-color:Red;
}
.C2
{
background-color :Black;
}
</style>
</head>
<body>
<table>
<tr id="t1">
<td>ws_hgo</td>
</tr>
<tr id="t2">
<td>guo</td>
</tr>
</table>
</body>
</html>
<tr class="t_tr" valign="top" style="line-height: 22px;">
var templateRow=document.getElementById("tplRow");
var rowstyle= window.getComputedStyle ? window.getComputedStyle(templateRow, null):templateRow.currentStyle;
row.style.lineHeight = rowstyle.lineHeight;