SCRIPT438:对象不支持属性或方法'onfocus_eventsubmit'

时间:2016-09-26 15:35:50

标签: javascript html

嗨,我有2页以下

page1.html

    <!DOCTYPE html>
    <html>
    <body>

    <p>Click the button to write some text in the new window and the source (parent) window.</p>

    <button onclick="myFunction()">Open Second Page</button>

    <script>
    var lw_url = "page2.html";
    function myFunction() {
       // var myWindow = window.open("", "myWindow", "width=200,height=100");
          var myWindow = window.open(lw_url,"_blank","location=no,menubar=no,resizable=no,status=yes,scrollbars=yes,toolbar=no,width=1000,height=650");
    }

     function onfocus_eventsubmit(){
          alert("onfocus_eventsubmit..")
     }
    </script>



    </body>
    </html>

page2.html

<!DOCTYPE html>
<html>
<body onload="submitPage();">

<p>This is page 2.</p>

<button onclick="CloseMe()">Close Me</button>

<script>

alert("lllllll")

function CloseMe() {
      window.close();
}
function submitPage(){
 alert('submitPage');
 window.opener.onfocus_eventsubmit();
}
</script>

</body>
</html>

我收到以下错误:

Uncaught SecurityError: Blocked a frame with origin "www.site1.com" from accessing a frame with origin "www.site2.com". Protocols, domains, and ports must match.

0 个答案:

没有答案