2014-07-03 50 views
0
<!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> 

如何在我的彈出窗口上創建一個新按鈕以關閉彈出窗口上的關閉按鈕,請幫助我。 我沒有得到如何在彈出窗口中創建新按鈕。如何在JS的彈出窗口中創建新的關閉按鈕?

+1

您需要標識符來關閉一個窗口,您將通過使用'window.open' – nightgaunt

回答

0

問題出在navigator.tainEnabled()。它在javaScript中不再受支持。

相關問題