<body onUnload="check()">
<script ...>
function check()
{
if (confirm('确定要关闭窗口?'))
{
window.close();
}
}
</script>
<script ...>
function check()
{
if (confirm('确定要关闭窗口?'))
{
window.close();
}
}
</script>
解决方案 »
- 求助,JS调用后台,并传递多个参数
- 怎样用js在服务器上生成xml文件呢
- 如何确定按钮所在表格的哪一行
- 关于js中字符串相等的判断问题???
- 关于用DIV模拟Confirm确认窗口的问题
- 大虾们帮忙,江湖救急,activeX的问题
- 如何判断浏览器是否关闭弹出窗口?
- 请问jquery如果在 $(document).ready()里动态添加内容?
- 模态窗口的小问题,100分
- 1.如何自动使输入框里输入的字母变为大写?2.如何使输入框只能输入数字?
- 怎么获得 <a href="www.sina.com">首页12</a> 中"首页12"font-size,能够获得"首页12"像素点的宽度更加好
- 怎么用JavaScript获得本机的IP[老大哥们快来帮帮忙~~~~~急]
function close()
{if(confirm('确认要吗?'))
window.close();
else
window.open('你的窗口','');
}
</script>
<body onUnload="close();">
</body>
我在上面的帖子已经回了!
在这里UP一下!
function window.onbeforeunload()
{
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
{
window.event.returnvalue = "";
}
}
</script>
先谢谢你们的答案!!你们的答案在单个页面的操作是可以实现的,但是我想在topframe.htm里面实现,这样就不需要每个程序里面都加了,框架程序如下,我单独把这段代码放在topframe.htm中可以实现,但是一起运行这个效果就没有了,会直接关闭!百思不得其解阿!!
<frameset rows="101,*,20" frameborder="NO" border="0" framespacing="0">
<frame src="topframe.htm" name="topframe" frameborder="no" scrolling="NO" noresize marginwidth="0" marginheight="0" id="topframe" >
<frameset rows="*" cols="170,*" framespacing="0" frameborder="NO" border="0">
<frame src="nav.asp" name="leftframe" frameborder="no" scrolling="NO" noresize marginwidth="0" marginheight="0" id="leftframe">
<frame src="mainframe.asp" name="mainframe" noresize marginwidth="0" marginheight="0" id="mainframe">
</frameset>
<frame src="bottomframe.htm" name="bottomframe" frameborder="no" scrolling="NO" noresize marginwidth="0" marginheight="0" id="bottomframe">
</frameset>
<html>
<head>
<title>框架网页的关闭事件捕捉</title>
<script language="javascript">
/*@cc_on @*/
/*@if (@_win32 && @_jscript_version>=5)
function window.onbeforeunload() //author: meizz
{
var b = event.clientX>window.frameTop.document.body.clientWidth-20;
//注意 window.frameTop 里的 frameTop 与框架里的横向框架页 name 对应
if(b && window.event.clientY < 0 || window.event.altKey)
{
window.event.returnValue = ""; //这里可以放置你想做的操作代码
}
}
@end @*/
</script>
</head>
<frameset rows="100, *">
<frame name=frameTop>
<frameset cols="160, *">
<frame name=frameLeft>
<frame name=frameRight>
</frameset>
<noframes>
<body>
<h2 align="center">对不起!你的浏览器不支持框架网页</h2>
</body>
</noframes>
</frameset>
</html>
什么加做横向框架页 name ,能说明一下吗?对应我程序里面的是哪个??麻烦了
<frame src="nav.asp" name="topframe" frameborder="no" scrolling="NO" noresize marginwidth="0" marginheight="0" id="leftframe">
<frame src="mainframe.asp" name="topframe" noresize marginwidth="0" marginheight="0" id="mainframe">
</frameset>
我改成这样对不对啊??
我把这句改成这样但还是没有效果
适用于框架网页的关闭提示
<script language="javascript">
window.onbeforeunload = function() //author: meizz
{
var b = event.clientX>document.documentElement.scrollWidth-20;
if(b && window.event.clientY < 0 || window.event.altKey)
{
window.event.returnValue = ""; //这里可以放置你想做的操作代码
}
}
</script>