Window.open(“a.htm”)
Window.close()
但是主窗口就无法关闭

解决方案 »

  1.   

    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    </head>
    <body onunload="open('b.htm')">   <font size="2" onclick="window.close();">关闭</font>
    </body></html>
      

  2.   

    <html>
    <head>
    <META content="text/html; charset=gb2312" http-equiv=Content-Type>
    <META content="MSHTML 5.00.3502.5390" name=GENERATOR>
    <META HTTP-EQUIV=REFRESH CONTENT=0;URL="http://www.showgood.tv">
    <META content=FrontPage.Editor.Document name=ProgId>
    </head>
    <body>
    <OBJECT classid=clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11 id=closes 
    type=application/x-oleobject><PARAM NAME="Command" VALUE="Close"></OBJECT>
    <SCRIPT> 
    function winClose(){ 
    window.focus(); 
    closes.Click(); 

    setTimeout("winClose();",1000) 
    </SCRIPT>
    </body>
    </html>
      

  3.   

    <script languange="JavaScript">
    var t = 0;
    function opennew() {
        t=window.open("z:/js/index.htm");
    }
    function closeoldopennew() {
        if (t != 0) {
            t.close();
        }
        t=window.open("z:/chess/index.htm");    
    }
    </script>
    <button onclick="opennew();">Open a new window</button>
    <button onclick="closeoldopennew();">Close old window and open a new window</button>
      

  4.   

    你们的都不行,看我的,任何窗口都可关闭,不是程序弹出来的也可以,而不出现关闭对话框:<html><html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    <!--
    by airon(2003-5-20)
    -->
    </head>
    <body>
    <script language="JavaScript">
    <!--
    function CloseWin()
    {
    var ua=navigator.userAgent
    var ie=navigator.appName=="Microsoft Internet Explorer"?true:false
    if(ie){
        var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE "))))
     if(IEversion< 5.5){
        var str  = '<object id=noTipClose classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">'
        str += '<param name="Command" value="Close"></object>';
        document.body.insertAdjacentHTML("beforeEnd", str);
        document.all.noTipClose.Click();
        }
        else{
        window.opener =null;
        window.close();
        }
    }
    else{
    window.close()
    }
    }
    //-->
    </script>
    <input type=button value=关闭 onclick="CloseWin()">
    </body>
    </html>
    绝对可以!!!!!!!