62,046
社区成员
发帖
与我相关
我的任务
分享
string str = "Reason.aspx?ID={0}";
str = string.Format(str, ViewState["ajdm_detail"].ToString());
string js = ("<script> window.showModalDialog('{0}', window, 'dialogWidth:400px;status:no;dialogHeight:400px'); </script>");
HttpContext.Current.Response.Write(string.Format(js, str));
B页面有个 “保存并返回”按钮,相关代码如下<input type ="button" value="保存" onclick="setFather()"/> <script language="javascript" type ="text/javascript" >
var k=window.dialogArguments;
//设置父窗口的值
function setFather()
{
//k.document.getElementById("txt10").value = document.getElementById("txt1").value
var a = "<%=getAnyou()%>";
k.document.getElementById("txtanyou").Text = a;
window.close();
}
</script>
getAnyou()是B页面后台的一个public方法。现在问题是,通过跟踪发现,弹出B页面的时候,居然立即执行getAnyou了,为什么会这样?