集中刷新父窗口,关闭子窗口的JS(后台)

  子窗口关闭,父窗口刷新

  1、这样写显然是父窗口重新加载一次,所以会出现我们常见的那种'重试'选项,所以不推荐

Response.Write( " <script>window.opener.location.reload();window.close();</script> " );

  2.推荐第二种:

  

Response.Write( " <script>window.opener.location.href=window.opener.location.href;alert('操作完成!');window.close();</script> " );

  3、子窗口传值给父窗口,然后关闭子窗口;

  获取父窗口控件的ID,然后把子窗口的得到的值传给它,随后关闭,很崇拜子窗口的献身精神啦,哈哈!

  

代码
Response.Write( " <script language='javascript'>window.parent.opener.document.getElementById('txtBlBm').value =' " + txtYgbm + " ';window.parent.opener.document.getElementById('txtBm').value =' " + valueYgbm + " ';window.parent.close();</script> " );

   4、获取父窗口的某个控件进行刷新

Response.Write("<script>window.opener.document.getElementById('btnSearch').click();alert('落实意见完成!');window.close();</script>");
5、关闭当前页面,不提示试图关闭网页提示
Response.write("<script>window.opener = null; window.open('','_self'); window.close();</script>");

 IE7shang
Response.Write("<script>window.parent.opener.document.getElementById('btnSearch').click();alert('操作完成!');window.open('','_self');window.close();</script>");

你可能感兴趣的:(js)