Javascript简单的调用,可是老是出错!高手请进!
首先有两个网页,起始页名为index.aspx(父窗口),通过单击父窗口的按钮,以模式对话框的形式打开一个子窗口(b.aspx),现在在b.aspx将要关闭时想调用index.aspx中用Javascript写好的一个函数,现在要如何实现?
现贴出我的部份代码请大家帮忙想想办法:
index.aspx中调用子窗口的函数如下:
string result = " ";
result += " <script> ";
result += "if(window.showModalDialog){var result=window.showModalDialog( ' " + "b.aspx " + " ',window);} ";
result += "else{var result=window.open( ' " + "b.aspx " + " ',\ "mcePopup\ ", 'modal=yes,dialog=yes,width=400,height=450 '); ";
result += "result.focus();} ";
result += " </script> ";
Response.Write(result);
在b.aspx(子窗口)中关闭对话框之前我要调用在index.aspx的 <head> 部份的一个Javascript函数如名为a(row);我的代码如下,可是没有成功请大家帮帮忙!
Response.Write( " <script> ");
Response.Write( "if(window.showModalDialog){var k=window.dialogArguments;alert(k);k.eval(\ "a()\ ");alert(2);window.close();} ");
Response.Write( "else{window.opener.a(123);window.close();} ");
Response.Write( " </script> ");
其中有个前提中父窗口调用子窗口别人的代码写好了,我不能改只能在子窗口这边动手脚!
------解决方案--------------------window.oponer.你父窗口函数(参数)
------解决方案--------------------window.oponer.你父窗口函数(参数)