如何使用jquery关闭一个窗口 [英] How to close a window using jquery

查看:320
本文介绍了如何使用jquery关闭一个窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用jquery关闭所有浏览器兼容性的窗口?

how to close a window using jquery for all browser compatibility?

<input type="button" name="backButton" value="Close" 
       style="background-color:#245f91; color:#fff;font-weight:bold;" 
       onclick="window.close();">

这个 onclick 事件在IE中正常工作。

This onclick event is working in IE. Could u please anyone help me to write code in jquery.

推荐答案

$(element).click(function(){
    window.close();
});

注意:您可以关闭您未打开的任何窗口与 window.open 。直接调用 window.close()会询问用户一个对话框。

Note: you can not close any window that you didn't opened with window.open. Directly invoking window.close() will ask user with a dialogue box.

这篇关于如何使用jquery关闭一个窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆