87,904
社区成员
发帖
与我相关
我的任务
分享
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$("input[name='add']").click(function(){
$("#nb").append($("#ob").html());
});
$("input[name='del']").click(function(){
//$("#nb").empty(); //全部删除
$("#nb").children("tr:last").remove();//删除最新添加的
});
});
</script>
</head>
<body>
<table width="100%" border="5" cellspacing="0" cellpadding="0" style=" border-color:#F00">
<tbody id="ob" >
<tr>
<td valign="top">AAAA<input type="button" name="add" value="添加" />
<input type="button" name="del" value="删除" />
</td>
</tr>
</tbody>
<tbody id="nb"></tbody>
</table>
</body>
</html>
$(document).ready(function(){
$("input[name='add']").click(function(){
$("#nb").append($("#ob").html());
});
$("input[name='del']").click(function(){
//$("#nb").empty(); //全部删除
$("#nb").children("tr:last").remove();//删除最新添加的
});
});
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script src="jquery-1.4.4.min.js"></script>
</head>
<script type="text/javascript">
<!--
function add(){
var content = $("#ob").html();
$("#nb").append(content);
}
function remove(){
$("#nb").html("");
}
//-->
</script>
<body>
<table width="100%" border="1" cellspacing="0" cellpadding="0" >
<tbody id="ob">
<tr>
<td valign="top">AAAA</td>
<td>
<input type="button" name="add" id="add" value="添加" onclick="add()" />
<input type="button" name="del" id="del" value="删除" onclick="remove()"/>
</td>
</tr>
</tbody>
<tbody id="nb"></tbody>
</table>
</body>
</html>