就是:
地址栏中,有一系列的网站地址,我选择了其中一个后,页面就alert。或者自己手动输入一个网站地址,按了回车后,页面也alert但是:自己submit自己,页面不能alert

解决方案 »

  1.   

    <html><head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>new</title>onbeforeunload<SCRIPT LANGUAGE="JavaScript" for=window Event=onbeforeunload>
    <!--
    if(document.referrer!=null){
      alert("abc");
      }
    //-->
    </SCRIPT><script>
    function bb(){
     document.FM.submit();
    }
    </script>
    </head><body ><form method="POST" action="" name =FM onsubmit=" bb()" >
    <input type="submit" value="button" name="B3"></p>
    </form></body></html>
      

  2.   

    <html><head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>new</title>
    <script>
    function aa(){
      alert("aaa");
    }function bb(){
     document.body.onunload="";//把事件取消
     document.FM.submit();
    }
    </script>
    </head><body onunload="aa()"><form method="POST" action="" name=FM>
    <input type="button" value="button" name="B3" onclick="bb()"></p>
    </form></body></html>
      

  3.   

    页面提交时带一个参数,如果有这个参数就不alert
      

  4.   

    fandiy(龙霄溪舞) 
    的方法看起来貌似不错哦
      

  5.   

    look
    -------------------------------------------------------------------
    <html><head>
    <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>new</title>
    <script>
    var thisPage=false;function aa(){
      alert("abc")
    }function bb(){
    thisPage=true;
     document.FM.submit();
    }window.onbeforeunload=function(){
    if(!thisPage)alert("abc");
    }
    </script>
    </head><body><form method="POST" action="" name = FM><input type="button" value="button" name="B3" onclick="bb()"></p>
    </form></body></html>