首先父窗有一个test()方法。
调用模式窗体window.showModalDialog('/test.html',window) 记得第二个参数一定要把父类窗体当参数传到模式窗体。
ajax
if (mesdivs == "aa") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
if(string=="ok")
{
window.close();
dialogArguments.window.test();
//reloadParent(2);
}
else
{
alert(string);
}
}
}
}
}
中间页面调用ajax
sendRequest("AddBomNumber.aspx?Id="+Id+"&M="+Str,"aa");
父窗体页面
function test()
{
__doPostBack("LinkButton1","");
}
模式窗体加入事件
<script for="window" event="onunload">
dialogArguments.window.test();
</script>
这样就可以在模式窗体关闭或者是重载的时候调用父类窗体的方法,如果不想让重载的时候调用父窗体的test()方法,可以给父窗体传一个变量,到时候根据变量的值来判断是不是要执行test()方法。