不准点击X来关闭当前网页
<script language=javascript>
function window.onbeforeunload()
{
if (event.clientX>document.body.clientWidth && event.clientY<0||event.altKey){
window.event.returnValue="确定要退出本页吗?";
new ActiveXObject("WScript.Shell").sendKeys("{ESC}")}
}
</script>
<script language=javascript>
function window.onbeforeunload()
{
if (event.clientX>document.body.clientWidth && event.clientY<0||event.altKey){
window.event.returnValue="确定要退出本页吗?";
new ActiveXObject("WScript.Shell").sendKeys("{ESC}")}
}
</script>
在我的浏览器里根本不起作用。何况用户还可以从文件和标题栏菜单选择关闭,总不能把这也禁止掉把。
再写一个onunload = newOpenWinfunction newOpenWin()
{
alert("你关一个,我再开一个!")
window.open(document.location.href,"","fullscreen=1")
}