实现类似资源管理器一样的选择方案
按住ctrl加选,按住shift连选,
active是选中后的css效果,自行设计或更改
var lastchecked;
$('#example tbody').on(click,tr, function(event) {
if(!lastchecked) {
lastchecked = this;
}
if(event.shiftkey) {
var start = $('#example tbody tr').index(this);
var end = $('#example tbody tr').index(lastchecked);
for(i=math.min(start,end);i if (!$('#example tbody tr').eq(i).hasclass('active')){
$('#example tbody tr').eq(i).addclass(active);
}
}
//清楚浏览器光标选择
if (window.getselection) {
if (window.getselection().empty) { // chrome
window.getselection().empty();
} else if (window.getselection().removeallranges) { // firefox
window.getselection().removeallranges();
}
} else if (document.selection) { // ie
document.selection.empty();
}
} else if ((event.metakey || event.ctrlkey)){
$(this).toggleclass('active');
} else {
$('#example tbody tr').removeclass('active');
$(this).toggleclass('active');
}
lastchecked = this;
});
ad:真正免费,域名+虚机+企业邮箱=0元