在单个页面里也只需
function window.onbeforeunload()
{
//禁止关闭窗口
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
{
alert("无法关闭");
window.event.returnValue="确定要退出本页吗?";
new ActiveXObject("WScript.Shell").sendKeys("{ESC}")
}
}不需要后面部分
function window.onbeforeunload()
{
//禁止关闭窗口
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
{
alert("无法关闭");
window.event.returnValue="确定要退出本页吗?";
new ActiveXObject("WScript.Shell").sendKeys("{ESC}")
}
}不需要后面部分
解决方案 »
- 为什么触发不了openfollowbox()方法?
- 用记事本写ajax调用页面地址怎么写
- UltraWebTree树型控件复选框问题 急急!!
- 求各位大侠 发个用JS写的注册信息时的验证码
- 论ie和firefox(mozila)中获取事件对象方式的异同-(绝对原创)
- 滑动门代码中如何动态改变一个隐藏域的值
- 谁用过jqgrid的cell editing?
- 在Javascript中有什么函数的功能等同于vbscript的Mid函数功能?本人对Mid函数功能也不了解!
- 打开窗口问题
- 怎么对showmodaldialog进行 resizeTo(x,y)
- 请教一个简单问题!
- 哪有好的javascript学习网站
<html>
<head>
<script>
function window.onbeforeunload()
{
//禁止关闭窗口
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
{
alert("无法关闭");
window.event.returnValue="确定要退出本页吗?";
}
}
</script>
</head>
<frameset rows="64,*">
<frame name="header" scrolling="no" noresize target="main" src="f1.htm">
<frame name="main" src="f2.htm">
<noframes>
<body>
<p>此网页使用了框架,但您的浏览器不支持框架。</p>
</body>
</noframes>
</frameset>
</html>
之所以不能禁止关闭按钮关闭窗口,是因为组框架页面没有body,即document.body.clientWidth不存在
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 2</title>
<script>
function window.onbeforeunload()
{
window.event.returnValue="";
}
</script>
</head>
<frameset rows="64,*">
<frame name="header" scrolling="no" noresize target="main" src="f1.htm">
<frame name="main" src="f2.htm">
<noframes>
<body>
<p>此网页使用了框架,但您的浏览器不支持框架。</p>
</body>
</noframes>
</frameset>
</html>