Closing child pop-up and refreshing the parent page

前端 未结 3 1996
梦谈多话
梦谈多话 2020-12-06 07:31

I am trying to achieve the following.

  1. A link on a parent page will open a new child pop-up.
  2. In the child pop-up, the user enters some data and clicks
相关标签:
3条回答
  • 2020-12-06 07:44

    In the pop-up window:

    <script type="text/javascript">
    function proceed(){
       opener.location.reload(true);
       self.close();
    }
    </script>
    
    <form onsubmit="proceed()">
    ...
    </form>
    
    0 讨论(0)
  • 2020-12-06 07:47

    In the popup's code for closing/reloading:

    opener.location.reload();
    close();
    
    0 讨论(0)
  • 2020-12-06 07:59

    parent.html

    <a href="#" onclick='window.open("child.html","_blank","height=100,width=100,
    status=yes,toolbar=no,menubar=no,location=no");return false'>pop up</a>
    

    child.html

    <p>child window</p>
    <script>
    window.onload = function(){
        window.opener.location.reload(true);
        window.close();
    }();
    </script>
    
    0 讨论(0)
提交回复
热议问题