因为非常简单所以这个全选反选是有Bug的(练习思路可用),
$(document).ready(function () {
//全选
$("#chkAll").click(function () {
//如果当前按钮是被选中状态
if (this.checked) {
//那么所有按钮被选中
$("input:checkbox").attr("checked", true);
}
else {
//否则所有按钮不被选中
$("input:checkbox").attr("checked", false);
}
//反选按钮为不被选中
$("#chkRev").attr("checked", false);
})
//反选
//点击反选按钮
//获取每一个被选中的复选框
$("input:checkbox").each(function () {
//把选中的复选框,改成不被选中
$(this).attr("checked", !$(this).attr("checked"));
})
//此时全选按钮为不被选中
$("#chkAll").attr("checked", false);
})
})
光棒效果
$(function(){
$("tr:even").css("background-color", "#E6E6FA");
$("tr:odd").css("background-color", "#F8F8FF");
//鼠标滑入
$("tr").mouseover(function () {
//将原来有的颜色存进bg,然后改变
$(this).attr("bg", $(this).css("background-color"));
$(this).css("background-color", "#FFB6C1");
});
//鼠标滑出
$("tr").mouseout(function () {
//将原来有的颜色还给它
$(this).css("background-color",$(this).attr("bg"));
});
})