<body onUnload="check()">
<script ...>
function check()
{
   if (confirm('确定要关闭窗口?'))
   {
      window.close();
   }
}
</script>

解决方案 »

  1.   

    <script>
    function close()
    {if(confirm('确认要吗?'))
       window.close();
     else 
      window.open('你的窗口','');
    }
    </script>
    <body onUnload="close();">
    </body>
      

  2.   

    hoho~~
    我在上面的帖子已经回了!
    在这里UP一下!
      

  3.   

    <script language=javascript>
    function window.onbeforeunload()
    {
      if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
      {
        window.event.returnvalue = "";
      }
    }
    </script>
      

  4.   

    agree  wen1818(冷月孤心)
      

  5.   

    To冷月孤星和梅花雪,
    先谢谢你们的答案!!你们的答案在单个页面的操作是可以实现的,但是我想在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>
      

  6.   

    框架网页的关闭事件捕捉
    <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>
      

  7.   

    To梅花雪,
    什么加做横向框架页 name ,能说明一下吗?对应我程序里面的是哪个??麻烦了
      

  8.   

    <frameset rows="*" cols="170,*" framespacing="0" frameborder="NO" border="0">
        <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>
    我改成这样对不对啊??
      

  9.   

    取这个横向贯穿的框架页宽度, 主要就是判断 用户点击时鼠标点击的位置, 在单个页面里直接判断 event.clientX > document.body.clientWidth 就好了, 但是在框架页面里取不到框架页面本身的 body.clientWidth 值, 所以转化一下, 取框架里横向贯穿的那个框架页面的宽度作为判断的标准.
      

  10.   

    <body name="VirtualBody" onbeforeunload="event.returnValue='请注意:关闭之后将无法再次显示!!确定要关闭此视窗??';">
      

  11.   

    var b = event.clientX>window.topframe.document.body.clientWidth-20;
    我把这句改成这样但还是没有效果
      

  12.   

    我重新写了一下这个函数, 你把它放在你的框架网页里即可:
    适用于框架网页的关闭提示
    <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>