繁体   English   中英

我如何先显示警告框,然后重定向到带有查询字符串的任何页面?

[英]How do I show the Alert Box first and then redirect to any page with query strings?

ScriptManager.RegisterStartupScript(UpdatePanel2, this.GetType(), "click", "alert('This Email address is already registered...');window.location.href ='test.aspx'", true);

通过使用上面的代码,我能够显示警告框,然后重定向到 test.aspx 页面。

但是当我必须传递带有地址的查询字符串时,问题就来了:

ScriptManager.RegisterStartupScript(UpdatePanel2, this.GetType(), "click", "alert('This Email address is already registered...');window.location.href ='test.aspx?WidgetID='" + Request.QueryString["WidgetID"] + "'&lan='" + readCookie() + "'&seeHome=true'", true);

提前致谢

您的代码有不必要的 (') s,它会破坏 javascript 中的字符串。试试这个

ScriptManager.RegisterStartupScript(UpdatePanel2, this.GetType(), "click", "alert('This Email address is already registered...');window.location.href ='test.aspx?WidgetID=" + Request.QueryString["WidgetID"] + "&lan=" + readCookie() + "&seeHome=true'", true);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM