try:
<script>
var w=null;
function window.onbeforeunload()
{
  if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
  {
    w=window.open();
    w.document.write('<script>setTimeout("window.close();",2000);<\/s'+'cript>')
  }
}
</script>

解决方案 »

  1.   

    c=window.open("1.htm")
    setTimeout("c.close()",5000) //5秒钟后自动关闭所打开的窗口
      

  2.   

    如果我想打开指定的页面,如:a.htm如何办?
    <script>
    var w=null;
    function window.onbeforeunload()
    {
      if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
      {
        w=window.open("a.htm");
        w.document.write('<script>setTimeout("window.close();",2000);<\/s'+'cript>')
      }
    }
    </script>
    这样对吗?
      

  3.   

    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <TITLE></TITLE>
    </HEAD>
    <BODY onUnload=window.open("blank.html","def","height=200,width=300")></BODY>
    </HTML>
      

  4.   

    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <TITLE></TITLE>
    </HEAD>
    <BODY onUnload=opw()><script language=javascript>
    function opw()
    {
    var w=window.open("blank.html","def","height=200,width=300")
    w.document.write("<script language=javascript>")
    w.document.write("setTimeout('self.close();',500);")
    w.document.write("</scrip"+"t>")
    }
    </script>
    </BODY>
    </HTML>
      

  5.   

    打开指定的页面的话,最好在指定的页面上的<body onload="setTimeout('window.close()',2000)">