window.opener

1.打开父窗口:

    var url = "http://" + window.location.host + "/ContratorSelfAssess/AssessPaper?data=" + data;
    window.open(encodeURI(url), "100%,height:100%,toolbar:true");


2.window.opener 实际上就是通过window.open打开的窗体的父窗体。即 window.opener是指调用window.open方法的窗口。 比如在父窗体parentForm里面 通过 window.open("subForm.html"),那么在subform.html中 window.opener 就代表parentForm,可以通过这种方式设置父窗体的值或者调用js方法。

作用:

   (1)window.opener.test(); ---调用父窗体中的test()方法

   (2)如果window.opener存在,设置parentForm中stockBox的值。

       if (window.opener && !window.opener.closed) {

       window.opener.document.parentForm.stockBox.value = symbol;}

   (3)在子页面中想要刷新父页面。window.opener就相当于主窗口的window.

        主窗口刷新:window.opener.location.reload();或者window.opener.yourformname.submit()



 

 

2.

要么生,要么死
原文地址:https://www.cnblogs.com/llljpf/p/7141187.html