<html>
<head>
<title>a.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->//引入js
<script type="text/javascript" src="Jquery/jquery-1.8.2.min.js"></script></head>
<script type="text/javascript">
$(function(){
$("button :eq(0)").click(function(){
$("#div").show();
});
$("button :eq(1)").click(function(){
$("#div2").show();
var id=$(":checkbox:checked").parent().parent().children().eq(1).text();
var name=$(":checkbox:checked").parent().parent().children().eq(2).text();
$("#gid").val(id);
$("#gname").val(name);
});
$("button :eq(2)").click(function(){
$(":checkbox:checked").parent().parent().remove();
});
})
function add(){
$("#div").hide();
var id=$("#id").val();
var name=$("#name").val();
$("#table").append("<tr id='tr'><td><input type='checkbox'/></td><td>"+id+"</td><td>"+name+"</td></tr>");
}
function update(){
$("#div2").hide();
$(":checkbox:checked").parent().parent().children().eq(1).text($("#gid").val());
$(":checkbox:checked").parent().parent().children().eq(2).text($("#gname").val());
}
</script>
<body>
<button>添加</button><button>修改</button><button>删除</button>
<table id="table">
<Tr>
<td></td><td>编号</td><td>姓名</td>
</Tr>
<Tr>
<td><input type="checkbox"/></td><td>1001</td><td>aaa</td>
</Tr>
<Tr>
<td><input type="checkbox"/></td><td>1002</td><td>bbb</td>
</Tr>
<Tr>
<td><input type="checkbox"/></td><td>1003</td><td>ccc</td>
</Tr>
</table>
<div id="big">
<div id="div" style="display: none;">
编号:<input type="text" name="id" id="id"/>姓名:<input type="text" name="name" id="name"/><input type="button" value="保存" οnclick="add()" />
</div>
<div id="div2" style="display: none;">
编号<input type="text" id="gid"/> 姓名:<input type="text" id="gname"/><input type="button" value="修改" οnclick="update()"/>
</div>
</div>
</body>
</html>
<head>
<title>a.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->//引入js
<script type="text/javascript" src="Jquery/jquery-1.8.2.min.js"></script></head>
<script type="text/javascript">
$(function(){
$("button :eq(0)").click(function(){
$("#div").show();
});
$("button :eq(1)").click(function(){
$("#div2").show();
var id=$(":checkbox:checked").parent().parent().children().eq(1).text();
var name=$(":checkbox:checked").parent().parent().children().eq(2).text();
$("#gid").val(id);
$("#gname").val(name);
});
$("button :eq(2)").click(function(){
$(":checkbox:checked").parent().parent().remove();
});
})
function add(){
$("#div").hide();
var id=$("#id").val();
var name=$("#name").val();
$("#table").append("<tr id='tr'><td><input type='checkbox'/></td><td>"+id+"</td><td>"+name+"</td></tr>");
}
function update(){
$("#div2").hide();
$(":checkbox:checked").parent().parent().children().eq(1).text($("#gid").val());
$(":checkbox:checked").parent().parent().children().eq(2).text($("#gname").val());
}
</script>
<body>
<button>添加</button><button>修改</button><button>删除</button>
<table id="table">
<Tr>
<td></td><td>编号</td><td>姓名</td>
</Tr>
<Tr>
<td><input type="checkbox"/></td><td>1001</td><td>aaa</td>
</Tr>
<Tr>
<td><input type="checkbox"/></td><td>1002</td><td>bbb</td>
</Tr>
<Tr>
<td><input type="checkbox"/></td><td>1003</td><td>ccc</td>
</Tr>
</table>
<div id="big">
<div id="div" style="display: none;">
编号:<input type="text" name="id" id="id"/>姓名:<input type="text" name="name" id="name"/><input type="button" value="保存" οnclick="add()" />
</div>
<div id="div2" style="display: none;">
编号<input type="text" id="gid"/> 姓名:<input type="text" id="gname"/><input type="button" value="修改" οnclick="update()"/>
</div>
</div>
</body>
</html>