參數(shù).close問題,為什么關(guān)閉不了頁面呢
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>close()</title>
? <script type="text/javascript">
???? function ass(){
???? var mywin= window.open("http://www.baidu.com");
???? var pages = confirm("是否關(guān)閉頁面?");
???????? if(pages == true){
???????????? mywin.close();
???????????? alert("成功關(guān)閉");
???????? }else{
???????????? alert("沒有關(guān)閉");
???????? }
???? }
? </script>
</head>
<body>
<input type="button" value="點(diǎn)我下試試" onclick="ass()" />
</body>
</html>
為什么點(diǎn)確認(rèn)鍵,新打開的頁面還是無法關(guān)閉呢
2015-12-03
換成慕課網(wǎng)也沒有問題
2015-12-02
我這測(cè)試 ,你的代碼是沒有問題的,注意關(guān)閉的不是當(dāng)前頁面,而是重新打開的一個(gè)頁面。