<body onbeforeunload="alert(window.location.href)">

解决方案 »

  1.   

    我是要在主页面判断,你那body是加在什么地方?
      

  2.   

    **I think these sourcecodes are so simple that no need more explain**parent.htm
      <head>
    <script>window.open("son01.htm")
    </script>
    </head>
    <body>
    <input type=text name="textn" >
    </body>
    **son01.htm
    <head>
    <script>
    function maincall()
    {
    window.opener.textn.value=document.location.href
    }function changehref()
    {
    document.location.href="son02.htm"
    }
    </script>
    </head>
    <body onbeforeunload="maincall()">
    <input type=button name="buttonn" value="href to son02.htm" onclick="changehref()">
    </body>
    **son02.htm
    <head>
    <script>
    function maincall()
    {
    window.opener.textn.value=document.location.href
    }function changehref()
    {
    document.location.href="son01.htm"
    }
    </script>
    </head>
    <body onbeforeunload="maincall()">
    <input type=button name="buttonn" value="href to son01.htm" onclick="changehref()">
    </body>