aaa.aspx 点击按钮弹出一个showModalDialog 在服务器端执行完功能后我想关闭showModalDialog 并返回aaa.aspx
我用的是
Page.RegisterStartupScript("", "<script language='javascript'>window.close();</script>");
Response.Redirect("Site.aspx");
现在为什么我关闭了showModalDialog 但是返回的是在showModalDialog 小窗口打开.我想关闭showModalDialog 后直接重新加载一次aaa.aspx 如何做?
我用的是
Page.RegisterStartupScript("", "<script language='javascript'>window.close();</script>");
Response.Redirect("Site.aspx");
现在为什么我关闭了showModalDialog 但是返回的是在showModalDialog 小窗口打开.我想关闭showModalDialog 后直接重新加载一次aaa.aspx 如何做?
如果手动点关闭.回来了aaa.aspx 但是还得手动刷新一次
我现在直接在showModalDialog 里回到aaa.aspx让他重新加载
showModalDialog 举个例子 .1.aspx 2.aspx
kv=window.showModalDialog("2.aspx",window,"center:yes;status:no;scroll:no;help:no;dialogWidth=320px;dialogHeight=150px");1.aspx 弹出 2.aspx ,/*一种方案:子窗体直接给父窗体赋值,事件全部在子窗体中处 :
2.aspx 处理 1.aspx 里面的事务,就是刷新
window.dialogArguments.document.Form1.Text1.value=document.getElementById('s2').value;
/*第二种方案:子窗体将值传回父窗体,由父窗体处理*/
window.returnValue= document.getElementById('s2').value; window.close(); //---------子窗体关闭之前,你可以做的事情。===========完整实例:====================
<script language="javascript" type="text/javascript">
function vv()
{
kv=window.showModalDialog("test2.aspx",window,"center:yes;status:no;scroll:no;help:no;dialogWidth=320px;dialogHeight=150px");
/* 1
var newoption=document.createElement("Option")
newoption.text=kv;
document.getElementById("ee").options.add(newoption);
*/
/*2*/
var option=new Option(kv,kv);
document.getElementById("ee").options.add(option);
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<span>演示ASP.NET 窗体传值</span> <input type="text" id="Text1" name="Text1" runat="server">
<select id="ss" runat="server">
</select>
<select id="ee" runat="server">
</select>
<input type="button" value="OK" onclick="vv()">
</form>
</body>
</HTML>
===================
<script language="javascript" type="text/javascript">
function cc()
{
/*一种方案:子窗体直接给父窗体赋值,事件全部在子窗体中处理*/
window.dialogArguments.document.Form1.Text1.value=document.getElementById('s2').value;
/* 正确赋值*/
var newoption=window.dialogArguments.document.createElement("Option")
newoption.text=document.getElementById('s2').value;
window.dialogArguments.document.getElementById("ss").options.add(newoption);
/*第二种方案:子窗体将值传回父窗体,由父窗体处理*/
window.returnValue= document.getElementById('s2').value;
window.close();
}
function vv()
{
g_pop=new Popup({ contentType:1,isReloadOnClose:false,width:420, height:150 });
g_pop.setContent("title","添加新标题");
g_pop.setContent("contentUrl","test3.aspx");
g_pop.build();
g_pop.show();
}
</script>
</HEAD>
<body>
<base target="_self">
<form id="Form1" method="post" runat="server">
<select id="s2" name="sel">
<option selected="selected" value="111">111</option>
<option value="222">222</option>
<option value="333">333</option>
<option value="444">444</option>
</select>
<input type="button" value="设置" onclick="vv();return false;">
<input type="button" value="确定" id="Button2" name="Button2" onclick="cc()">
</form>
</body>
</HTML>