<body onbeforeunload="var a=1;if(a==1){return 'ok?'}">

解决方案 »

  1.   

    TO hbhbhbhbhb1021(天外水火(我要多努力))
    这个方法试了很多遍,都会出提示框,不行。
    1、当a=0时,关闭网页时不出任何提示框。
      

  2.   

    <script lanuage=javascript>
    function c()
    {
      var i;
      if (i==1)
       {
        window.opern=null;
        window.close();
       }
      elseif (i==0)
      {
       window.close();
      }
    }
    </script><body onbeforeunload="c()">
    ---------------个性签名----------
    http://www.esoftnow.com/bbs
    技术论坛,欢迎光临!
      

  3.   

    上面有错:window.opern=null;改为:window.opener=null;
     
      

  4.   

    上面的方法不会啊
    <script language=javascript>
    a=0;
    </script>
    <body onbeforeunload="if(a==1){return 'ok?'}">
    <input name=button1 type=button value="a=0" onclick="a=0">
    <input name=button2 type=button value="a=1" onclick="a=1">
      

  5.   

    TO moodboy1982(自由人- http://www.esoftnow.com/bbs)
    i==1时确时没提示,可是只要执行c()函数,网页就关闭幕式,即使无window.close();网页也关闭。怎样可以在i==0时网页可以不关闭?{去掉window.close();是无用的}
      

  6.   

    TO hbhbhbhbhb1021(天外水火(我要多努力))
    我已经试过了,a==0时出提示框。我想要a=0时不出提示框,直接关闭网页。