台灣最大程式設計社群網站
∣
免費加入會員
∣登入
∣回首頁∣
您好
線上人數
1107
會員總數:
246713
討論主題:
190131
討論區
程式下載/上傳
科技新聞
專欄文章
會員中心
加值服務
外包接案
求職求才
登入
登出
歡迎您
免費
加入會員
討論區選單
新手必讀
我要提問!!
討論區
個人討論區
我的關注主題
我的黑名單
討論區EP英雄榜
專家等級說明
討論區常見問題
兌換發問點數QP
扣點申請加值服務
申請版主
開發工具
ASP
ASP.NET
C#
VB.NET
VB6
C/C++
PHP
Java
Java Script/ Node.js
AJAX / JSON / jQuery
其他語言
行動裝置開發
Android APP 開發
iOS APP/ swift 開發
Windows Phone APP
資料庫
ACCESS
MS SQL
MySQL
Oracle
其他DB
多媒體 / 網管
CSS/HTML5/Bootstarp
影像處理
office VBA / WinOS
Windows 伺服器
Linux / Unix
網管 / 資安 / VM
硬體 / 週邊 / 其他
綜合
求職求才
外包接案
心情甘苦談
網站經營 / 合夥 / 證照
建言 / 公告
文章區
專欄文章
科技新聞
Blog精華文章
討論區列表
>>
Java Script/ Node.js
>> Chrome瀏覽器頁面切換 window.close沒反應
[]
[
我要回覆
]
1
Chrome瀏覽器頁面切換 window.close沒反應
價值 : 100 QP
點閱數:965 回應數:2
樓主
Icewater
0
3
320
4
發送站內信
各位好,想請問為甚麼開啟h1.html 再透過連結的方式到h2.html的button會沒有作用呢?
ps.用IE是可以的.
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <a href="h2.html">h2</a> <input id="Button1" type="button" value="button" onclick="window.open('', '_self', ''); window.opener = null; window.close()" /> </body> </html>
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <a href="h1.html">h1</a> <input id="Button1" type="button" value="button" onclick="window.open('', '_self', ''); window.opener = null; window.close()" /> </body> </html>
搜尋相關Tags的文章:
[ window.close ] ,
[ chrome ] ,
本篇文章發表於2018-12-10 19:10
1樓
最有價值解答
浩瀚星空
看了一下你用了_self。也就是說,會跳開目前正在運行中的頁面重載。
這樣子的話。其實你接在後面的 window.opener = null; window.close()
自然也就不會運行了。
因為都已經換頁了。命令自然就消失了。
本篇文章回覆於2018-12-12 15:45
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔--
2樓
作者回應
Icewater
謝謝,這樣我就瞭解了,也附上我現在都能關閉的方式
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <a href="h2.html">h2</a> <input id="Button1" type="button" value="button1" onclick=" window.opener = null; window.close();" /> <input id="Button2" type="button" value="button2" onclick="parent.window.close(); window.open('h2.html', '', '');" /> </body> </html>
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <a href="h1.html">h1</a> <input id="Button1" type="button" value="button" onclick=" window.opener = null; window.close()" /> <input id="Button2" type="button" value="button2" onclick="parent.window.close(); window.open('h1.html', '', '');" /> </body> </html>
本篇文章回覆於2018-12-13 08:47
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔--
1
回覆
如要回應,請先
登入
.
|
網站導覽
|
網站介紹
|
4P點數說明
|
電子報
|
小舖活動
|
大事紀
|
廣告刊登
|
常見問題
|
聯絡我們
|
版權所有 ©copyright 2000 All Rights Reserved