请教:如何不让页面关闭,在用户点击窗口右上角的“X”的时候!百分相赠!

peer4 2002-08-23 09:11:12
如题!
...全文
42 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
peer4 2002-08-23
  • 打赏
  • 举报
回复
It's okey!再次感谢!
qiushuiwuhen 2002-08-23
  • 打赏
  • 举报
回复
<script language=javascript>
showModelessDialog("about:<body onbeforeunload=return('确定要退出本页吗?')>")
</script>


Lostinet 2002-08-23
  • 打赏
  • 举报
回复
把当前信息储存下来,关了又打开好了。。
peer4 2002-08-23
  • 打赏
  • 举报
回复
确切的说,针对的是非模式对话框,而不是普通IE窗口!
非常感谢各位!分不够我会继续加!
meizz 2002-08-23
  • 打赏
  • 举报
回复
<script language=javascript>
function window.onbeforeunload(){
if (event.clientX>document.body.clientWidth && event.clientY<0||event.altKey){
window.event.returnValue="确定要退出本页吗?";
var wsh = new ActiveXObject("WScript.Shell");
wsh.sendKeys("{ESC}")}
}
</script>
saucer 2002-08-23
  • 打赏
  • 举报
回复
no way, the best you can do are the following (but they also run when the user changes pages, so it is your responsibility to make sure that will not happen, but I heard IE7 is going to have an onwindowclose event):


<script language="javascript">
function window.onbeforeunload()
{
event.returnValue = "are you sure you want to exit?";
}
</script>

or

<script language="javascript">
function window.onunload()
{
window.open(window.location.href,"_blank");
}
</script>
seabell 2002-08-23
  • 打赏
  • 举报
回复
<script for=window event=onbeforeunload>
if (event.clientX>document.body.clientWidth &&event.clientY<0||event.altKey)
return ""
</script>

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧