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

时间:2014-07-03 12:37:11

标签: javascript popupwindow

<!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>

如何在弹出窗口上创建一个新按钮,点击关闭按钮关闭弹出窗口,请帮助我。 我没有得到如何在弹出窗口中创建一个新按钮。

1 个答案:

答案 0 :(得分:0)

问题在于navigator.tainEnabled()。它在javaScript中不再受支持。