Javascript 如何在JS中的弹出窗口中创建新的关闭按钮?

Javascript 如何在JS中的弹出窗口中创建新的关闭按钮?,javascript,popupwindow,Javascript,Popupwindow,如何在我的弹出窗口上创建一个新按钮以在单击关闭按钮时关闭该弹出窗口请帮助我。 我不知道如何在弹出窗口中创建新按钮。问题在于navigator.tainEnabled。javaScript不再支持它。您需要标识符来关闭使用window.open获得的窗口 <!DOCTYPE html> <html> <body> <p>Click the button to open an about:blank page in a new browser win

如何在我的弹出窗口上创建一个新按钮以在单击关闭按钮时关闭该弹出窗口请帮助我。
我不知道如何在弹出窗口中创建新按钮。

问题在于navigator.tainEnabled。javaScript不再支持它。

您需要标识符来关闭使用window.open获得的窗口
<!DOCTYPE html>
<html>
<body>

<p>Click the button to open an about:blank page in a new browser window  </p>
   <p id="demo"></p>

<button onclick="javascript: myFunction()">Try it</button>


<script  type="text/javascript">
                function myFunction() 
                {
                                var myWindow = window.open("http://192.168.1.101/sarika/Popups/tryit.html#part1", "","toolbar=yes, scrollbars=yes, resizable=yes, top=200, left=500, width=400, height=200,location=yes,fullscreen=no");
                                myWindow.document.write(location.host);
                                myWindow.document.write(navigator.taintEnabled());
                                //myWindow.document.write(history.length);
                                myWindow.document.write("<p>This is 'MsgWindow'. I am 200px wide and 100px tall!</p>");
                                myWindow.document.write("<button name='close' onclick='window.close()'  >Close</button>");   
                }


                 function redirect()
                 {
                    window.location.href = "page2.php";
                 }

</script>
 <body>
<A HREF="page2.php"> Page 2</A><br>
<INPUT TYPE="button" VALUE="New page" ONCLICK="redirect();">

</body>
</html>