為什么打開的是兩個窗口,關閉只能關一個
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>close()</title>
? <script type="text/javascript">
? ? ?var mywin=window.open("http://www.xianlaiwan.cn");
? ? ?//mywin.close();
? ? function a_close(){
? ? ? ? mywin.close();
? ? }
? </script>
</head>
<body>
? ? <input type="button" onClick='a_close()' value='關閉'/>
</body>
</html>
2018-12-06
我試了下正確的啊
2018-12-14
輸出是有先后順序的,你可以嘗試在腳本里面這么寫試試看
function openUrl(){
? ? ? ? ?
? ? ? ? ?var pages = confirm("是否關閉新頁面?");
? ? ? ? ?if(pages == true){
? ? ? ? ? ? ? ? mywin.close();?
? ? ? ? ? ? ? ? alert("頁面已關閉!");
? ? ? ? ?}else{
? ? ? ? ? ? ? ? alert("頁面未關閉!");
? ? ? ? ?}
? ? ? ? ?var mywin=window.open("http://www.xianlaiwan.cn");
? ? ?}
2018-12-06
從慕課網提交出來的蹦出兩個頁面,用txt改HTML運行只打開一個頁面。。。。