function check_close(){
     if(window.confirm("确定关闭?")){
         window.open(新页面);
     }else{
        return;
     }
}

解决方案 »

  1.   

    然后在你的关闭按钮上 调用这个函数:<input type="button" onClick="javascript:check_close()" value="关闭">
    就ok了
      

  2.   

    window.confirm("确定关闭吗?");
    这个样就可以了~~它一个确定和取消~
      

  3.   

    public class CloseTest extends JFrame{
    public CloseTest(){
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    // setDefaultCloseOperation(EXIT_ON_CLOSE);
    addWindowListener(new WindowAdapter(){
    public void windowClosing(WindowEvent e){
    System.out.println("windowClosing");
    // switch(JOptionPane.showConfirmDialog(null,null,"Do you really want to close the frame?",JOptionPane.YES_NO_OPTION)){
    switch(JOptionPane.showConfirmDialog(null,"Do you really want to close the frame?","...",
                        JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)){
    case JOptionPane.YES_OPTION:
    System.out.println("select yes");
    System.out.println("before dispose");
    dispose();
    System.out.println("after dispose");
    break;
    case JOptionPane.NO_OPTION:
    System.out.println("select no");
    break;
    default:
    }
    }

    public void windowClosed(WindowEvent e){
    System.out.println("windowClosed");
    System.exit(0);
    }
    });
    }
    public static void main(String[] args){
    JFrame f=new CloseTest();
    f.setVisible(true);
    }
    }
      

  4.   

    <script language=javascript>

    confirm("确定关闭?");
     window.open("新页面");
      </script>
      

  5.   

    哦,不好意思,我写错了,应该这样
    <script language=javascript>

    var truthBeTold = window.confirm("单击“确定”继续。单击“取消”停止。");
    if (truthBeTold) {
    window.open("你的新网页!");
    }  else  window.close();  </script>
      

  6.   

    <script language="javascript">
    window.onbeforeunload = function()
    {
      var n = window.event.screenX - window.screenLeft;
      var b = n > document.documentElement.scrollWidth-20;
      if(b && window.event.clientY < 0 || window.event.altKey)
      {
        if(window.confirm("单击“确定”继续。单击“取消”停止")){
             window.open();
         }else{
            return;
         }
      }
    }
    </script>