How to close a window using jQuery
如何使用jQuery关闭窗口以实现所有浏览器兼容性?
1 2 3 4 5 | <input type="button" name="backButton" value="Close" style="background-color:#245f91; color:#fff;font-weight:bold;" onclick="window.close();"> |
此
1 2 3 | $(element).click(function(){ window.close(); }); |
注意:您不能关闭任何未使用
使用
1 2 3 4 | function close_window(url){ var newWindow = window.open('', '_self', ''); //open the current window window.close(url); } |
只是
对于IE:
如果您只想打开IE浏览器并输入
注意:此方法不适用于Chrome或Firefox。
这仅适用于使用window.open()打开的窗口。 方法。 试试这个
1 2 | var tmp=window.open(params); tmp.close(); |