【发布时间】:2013-11-26 16:15:32
【问题描述】:
我的一个 ASP.NET 应用程序 (VB) 中有一个页面,该页面依赖于实时的 3rd 方服务,如果发现此服务已关闭,我将使用 jQuery 显示覆盖。我一直在对应用程序中的其他警告使用相同的方法-与此不同的是,它需要在用户单击警告弹出窗口上的按钮以删除覆盖层后进行重定向。出于某种原因,我收到错误“错误:属性 'warn_redirect' 的值为 null 或未定义,而不是函数对象。”
非常感谢任何帮助!我的代码如下:
jQuery
function warn_redirect(msg, title, nextpage) {
// show modal div
//alert(obj.id);
$("html").css("overflow", "hidden");
$("body").append("<div id='popup_overlay'></div><div id='popup_window'></div>");
$("#popup_overlay").addClass("popup_overlayBG");
$("#popup_overlay").fadeIn("slow");
// build warning box
$("#popup_window").append("<h1>" + title + "</h1>");
$("#popup_window").append("<p id='popup_message'><center>" + msg + "</center></p>");
$("#popup_window").append("<div class='buttons'><center><button id='continue' class='positive' type='submit'>OK</button></center></div>");
// attach action to button
$("#continue").click(popup_remove_redirect(nextpage));
// display warning window
popup_position(400, 300);
$("#popup_window").css({ display: "block" }); //for safari using css instead of show
$("#continue").focus();
$("#continue").blur();
}
function popup_remove_redirect(nextpage) {
$("#popup_window").fadeOut("fast", function () { $('#popup_window,#popup_overlay').trigger("unload").unbind().remove(); });
$("body", "html").css({ height: "auto", width: "auto" });
$("html").css("overflow", "");
window.location.href = nextpage;
}
这是VB.NET的调用代码:
If Status = "DOWN" Then
Dim clsUtility As New Utility
clsUtility.Emailer("email@company.com", "email@company.com", "", "", "The Service Is Down!", "Please investigate")
Dim ScriptString As String = "<script language='javascript'>"
ScriptString += "warn_redirect('Some warning message.', 'Warning', 'AnotherPage.aspx');"
ScriptString += "</script>"
ClientScript.RegisterStartupScript(Me.GetType, "warnscript", ScriptString)
'Response.Redirect("AnotherPage.aspx?ID=" & Session("SelKey") & "&UN=" & Header1.UserNumber) //this didn't work either
End If
【问题讨论】:
标签: javascript jquery asp.net vb.net