表格的行上下移动

 

//obj表示当前触发事件的对象,这里是单元格里面的A标签

function goDown(obj) {
moveShow();
var t = $(obj).parent().parent();
t.before($(t).next("tr")); //向下移动
moveHide();
}

function goUp(obj) {
moveShow();
var t = $(obj).parent().parent();
t.after($(t).prev("tr")); //向上移动
moveHide();
}
//隐藏
function moveHide() {
$(".up :first").hide();
$(".down :last").hide();
}
//显示
function moveShow() {
$(".up :first").show();
$(".down :last").show();
}

posted @ 2013-12-05 10:21  绝/いovの☆  阅读(186)  评论(0编辑  收藏  举报