关于showmodaldialog()不能中断主页面程序执行的问题
大家好:关于showmodaldialog()不能中断主页面程序执行的问题
以下是主页面的调用程序
protected void Dialog()
{
StringBuilder s = new StringBuilder();
s.Append("<script language=javascript>");
s.Append("var a=window.showModalDialog('submitBX.aspx','newwin','dialogHeight:200px;dialogWidth:290px;edge:Raised;center:Yes;help:Yes;resizable:No;status:No;');");
s.Append("if(a!=null)");
s.Append("document.all('txt1').value=a;");
//s.Append("if(a) window.location.reload();");
s.Append("</script>");
Type cstype = this.GetType();
ClientScriptManager cs = Page.ClientScript;
string sname = "showD";
if (!cs.IsStartupScriptRegistered(cstype, sname))
cs.RegisterStartupScript(cstype, sname, s.ToString());
}
这是次页面的调用程序
protected void btSubmit_Click(object sender, EventArgs e)
{
StringBuilder s = new StringBuilder();
s.Append("<script language=javascript>" + "\n");
s.Append("window.returnValue='" + this.GetSelectValue() + "';" + "\n");
s.Append("window.close();" + "\n");
s.Append("</script>");
Type cstype = this.GetType();
ClientScriptManager cs = Page.ClientScript;
string csname = "returnD";
if (!cs.IsStartupScriptRegistered(cstype, csname))
cs.RegisterStartupScript(cstype, csname, s.ToString());
}
我从主页面调出次页面,输入相应数据后,继续执行主页面调用语句之后的命令;可是程序刚一调出次页面,没有输入任何数据,就执行主页面之后的语句了。
如何才能实现和window.prompt()一样的效果,中断调用语句之后的命令呢?