<script language=javascript>
function c()
{
if (confirm("你确定要关闭吗?"))
{
opener=null;top.window.close()
}
}
</script>
<a href=# onclick="c()">关闭</a>

解决方案 »

  1.   

    楼上的在误导
    window.opener=null;window.close();
      

  2.   

    你们说的这个方法,为什么在IE5中还是不行,有没有一个适用所有IE版本的解决方法?
      

  3.   

    <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 fason(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> 
    http://blog.csdn.net/fason/archive/2003/06/23/18290.aspx
      

  4.   

    不是JSP-ASP-的问题
    <script language=javascript>
    window.opener=null;
    window.close()
    </script>
      

  5.   

    window.opener=null;
    window.close()只适用于IE5.5+Please Use 191301587(农民程序员)'s method
      

  6.   

    LxcJie(肖冲*爱*捷捷)
    不是吧,我在ie6中也用过,好使。