我有一个 gridview,它有一个用于删除一行的 asp 图像按钮。我在删除行时实现了淡入淡出效果;这工作正常。我的问题是淡入淡出效果始终有效-无论用户单击确定还是取消。只有当用户为确认框单击确定时,我才想要淡入淡出效果。我被困住了。下面是我的淡化效果代码。
function removeRow() {
if (confirm("Are you sure you want to delete this comment?")) {
$("#dnn_BlogCommentManager1_grdBlogComments td: input[type='image']").click(function () {
$tr = $(this).closest("tr");
if ($(this).hasClass("imgDelete")) {
$tr.css("background-color", "red");
$tr.fadeOut(500, function () { $tr.remove() });
}
});
}
else {
return false;
}
}
我知道我不能将点击事件放在函数内,但我不知道如何在removeRow
函数内获取点击的行。