我想在网页中如果在当前页面执行 关闭/最小化/切换页面/移动页面任意一项操作之前要弹出提示框,如果要执行这些操作则当前页面被提交关闭.如果不执行操作则又回到当前页面.
   求js实现代码...谢谢了!~

解决方案 »

  1.   


    confirm('真的要删除吗?'){ …… 
    }
      

  2.   

    <body onunload="javascript:return confirm('你确认要关闭窗口吗')">
      

  3.   

    <script language="javascript">
    alert("是否要提示!");
    </script>

    <script language="javascript">
    confirm("是否要提示!");
    </script>
      

  4.   

    <body onunload="javascript:return confirm('你确认要关闭窗口吗')">
      

  5.   

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head><body>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
    <meta name="Author" content="Aultoale" />
    <style type="text/CSS">
    body {font:normal 12px Verdana}
    a#tip {position:relative;left:75px; font-weight:bold;}
    a#tip:link,a#tip:hover {text-decoration:none;color:#000;display:block}
    a#tip span {display:none;text-decoration:none;}
    a#tip:visited {color:#000;text-decoration:underline;}
    a#tip:hover #tip_info {display:block;border:1px solid #F96;background:#FFEFEF;padding:10px 20px;position:absolute;top:0px;left:90px;color:#009933}
    </style>
    </head>
    <body>
    <a id="tip" href="#">
    移到这里试试!
    <span id="tip_info">这里是提示信息!</span>
    </a>
    </body>
    </html> 
    </body>
    </html>
      

  6.   

    <input type="button" name="button" onclick="return confirm('确定删除')"
      

  7.   

    除了关闭有个能检测到以外 ,其他的都检测不到
    <body onUnload="alert('关闭');">
    但你即使在这里用confirm还是没法阻止关闭
    你这种做法太过霸道,我要是用户绝对不肯来你的网站,所以浏览器也没提供这种功能
      

  8.   

    /**
     * Prompt user to confirm the operation when the button is clicked in the current page.
     *
     * @return true or false
     */
    function doContinue() {
    return confirm('确认执行此操作吗?!');
    //return confirm('<bean:message key="msg.delete.rcd" />');
    }function doClose(){
    if(doContinue())
    {
    windows.close();
    }
    }
      

  9.   


    JScript codefunction doContinue() {
    return confirm('确认执行此操作吗?!'); 
    //return confirm(' <bean:message key="msg.delete.rcd" />'); 
    } function doClose(){ 
    if(doContinue()) 

    windows.close(); 

    }