<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="JQueryDOM.WebForm2" %>
<!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 runat="server">
<title></title>
<style type="text/css">
.table1{ border-style:inset;
border-width: 2px; width:500px;border: solid 1px;}
image{ width:60px; height:60px;}
td{ text-align:center; }
.imgclass{ position:absolute; border:solid 1px #eee; width:200px; height:350px; display:none;}
</style>
<script src="Jquery1.7.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#chkall').click(function () {
// $('input[type=checkbox]').attr('checked', this.checked);
$('table :checkbox').attr('checked', this.checked);
// if (this.checked) {
// $('table tr td input[type=checkbox]').attr('checked', true);
// }
// else {
// $('table tr td input[type=checkbox]').attr('checked', false);
// }
})
$('#removenode').click(function () {
var ck = $('#form1 :checkbox:not(#chkall)');
ck.each(function (index) {
if (this.checked) {
$(' table tr[id=' + this.value + ']').remove();
}
})
})
$('table tr td image').mousemove(function (e) {
$('#imgshow').attr('src', this.src).css({ top: (e.pageY + 5), left: (e.pageX + 5) }).show();
})
$('table tr td image').mouseout(function () {
$('#imgshow').hide();
})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<table class="table1">
<tr><th>操作</th><th>编号</th><th>封面</th><th>作者</th><th>数量</th><th>单价</th></tr>
<tr id="0"><td><input type="checkbox" value="0" /></td><td>001</td><td><image src="images/林心如.jpg" /></td><td>王蕾</td><td>23</td><td>23</td></tr>
<tr id="1"><td><input type="checkbox" value="1" /></td><td>002</td><td><image src="images/林志玲.jpg" /></td><td>扬斐</td><td>34</td><td>34</td></tr>
<tr id="2"><td><input type="checkbox" value="2" /></td><td>003</td><td><image src="images/林志颖.jpg" /></td><td>交玉从</td><td>22</td><td>45</td></tr>
</table>
<table>
<tr><td>全选<input type="checkbox" id="chkall" /></td><td><input type="button" value="删除" id="removenode"/></td></tr>
</table>
<img class="imgclass" id="imgshow" />
</form>
</body>
</html>