Response.Write("<script> window.alert('请输入内容')</script>");背景为啥是空白的? 我在 .aspx 中,为了弹出窗口,用下面的语句,可是弹出的窗口背景是一片空白,较难看,有什么办法吗?Response.Write("<script> window.alert('请输入内容')</script>");背景为啥是空白的? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 this.ClientScript.RegisterStartupScript(typeof(string), "alert", "alert('请输入内容');", true); /// <summary> /// 显示消息提示对话框 /// </summary> /// <param name="page">当前页面指针,一般为this</param> /// <param name="msg">提示信息</param> public static void Show(System.Web.UI.Page page, string msg) { page.RegisterStartupScript("message", "<script language='javascript' defer>alert('" + msg.ToString() + "');</script>"); } 因为response.write输出的js在页面的头部,会首先执行,而alert会弹出对话框并阻塞,alert后面的html内容无法因为阻塞无法被渲染,显示为空白,只有等对话框返回后才继续显示 alert后面的html内容无法因为阻塞无法被渲染->alert后面的html内容因为阻塞无法被渲染 如果Form runt=server 那么(有服务器控件)Page.ClientScript.RegisterStartupScript(Page.GetType(), "error", "alert('xxxxxxxxxxxxx!');", true);或this.ClientScript.RegisterStartupScript(typeof(string), "alert", "alert('请输入内容');", true);如果没服务器控件,上面的代码则无效Response.Write(" <script> window.alert('请输入内容') </script>");背景是白色的也是正常的,因为只有等对话框返回后才继续显示 关于C#控件调用问题 关于中英文界面 请教使用DrawImage拼图的问题 DataSet可以同时对两个数据库操作吗? 请教如何实现文本框内容与控制台内容间的相互交互 50分 xeno 2004 和 xeno 2005哪个更好用???? IDisposable接口的疑问 能不能做个软件(客户端和服务器端)象windows局域网共享那样可以直接用,不用下载来在用? debug 问题:不能debug 急!!!!Help!!!! try包含的范围越大越好吗? 报表问题 我打开报表打印太慢~!!
this.ClientScript.RegisterStartupScript(typeof(string), "alert", "alert('请输入内容');", true);
/// 显示消息提示对话框
/// </summary>
/// <param name="page">当前页面指针,一般为this</param>
/// <param name="msg">提示信息</param>
public static void Show(System.Web.UI.Page page, string msg)
{
page.RegisterStartupScript("message", "<script language='javascript' defer>alert('" + msg.ToString() + "');</script>");
}
alert后面的html内容无法因为阻塞无法被渲染->alert后面的html内容因为阻塞无法被渲染
或
this.ClientScript.RegisterStartupScript(typeof(string), "alert", "alert('请输入内容');", true);如果没服务器控件,上面的代码则无效
Response.Write(" <script> window.alert('请输入内容') </script>");背景是白色的也是正常的,因为只有等对话框返回后才继续显示