try
onunload=[expression]
event

解决方案 »

  1.   

    var child = window.open(..........);child.varName = 10000000000000;
      

  2.   


    <body onbeforeunload="...aspx?paras=12333333";>
      

  3.   


    <html>
    <head>
        <title>PostDataToOtherPage</title>
        <script>
        function postdata(mydata)
        {
         window.open("OtherPage.htm?" + encodeURI(mydata));//把数据编码后,弹出新页面,把数据传递过去
         //window.open("OtherPage.asp?mydata=" + encodeURI(mydata));//如果是传递到asp或php等页面,得到传递过来的数据就太容易了。我就不详述了。
        }
        </script>
    </head><body onunload="postdata('Are you OK?');">
    请关闭页面!
    </body>
    </html>如果是传递到静态页面,用decodeURI(location.search.substr(1))得到传递过来的参数并解码:<html>
    <head>
    <title>接受提交演示</title>
    </head><body><SCRIPT lanaguage="javascript">
    var mydata = decodeURI(location.search.substr(1));
    document.write(mydata);
    </SCRIPT>
    </body>
    </html>