在jscript中,我能够弹出一条警报消息并重定向如下:
alert('" & message & "'); window.location.href = '" & redirectPage & "';"
这将弹出一条消息,等待用户的确认,然后重定向到新页面。
我现在正在使用漂亮的jquery UI:
$.alert(""" & message & """, """ & title & """);
当我包含转发到新地址的window.location.href
时,用户不再有机会确认信息框。(它出现和消失)
有没有办法确保用户在 jquery 警报中单击"确定"?
在
例程中添加了关闭函数
$.extend({
alert: function (message, title, redirect) {
$("<div></div>").dialog({
buttons: { "Ok": function () { $(this).dialog("close"); } },
close: function (event, ui) { $(this).remove(); },
resizable: false,
title: title,
modal: true,
close: function (event, ui)
{
if (redirect != '')
{
window.location.href = "default.aspx";
}
}
}).text(message);
}
});