zoukankan      html  css  js  c++  java
  • 自动关闭IE6或IE7窗口时不出现提示

    在IE7中使用window.close();自动关闭窗口时会出现确认关闭的提示.

    以下代码可以防止出现这样的提示:
    JavaScript代码
    <script language="javascript">   
     
        openLogin();   
           
        function randomNumber(limit){   
          return Math.floor(Math.random()*limit);   
        }   
           
        function openLogin() {   
           
            var loginWidth=718;   
            var loginHeight=540;   
            x=(screen.width-loginWidth)/2;   
            y=(screen.height-loginHeight)/2;   
           
            window.resizeTo(loginWidth,loginHeight+20);   
            window.moveTo(x,y);   
               
            var myWin = window.open("http://www.google.com","contactWeb"+randomNumber(10000),"toolbar=0,location=0,status=0,menubar=0,scrollbars=auto,resizable=no,width="+loginWidth+",height="+loginHeight+",left="+x+",top="+y);   
            window.opener = null;    // 关闭IE6、IE7窗口不再提示   
            window.open('','_top'); // 关闭IE7窗口不再提示   
            window.close();   
        }   
           
    </script>   

    以下是在IE6中有效的代码:
    JavaScript代码
    function DestroySelf()   
    {   
        var oMe = window.self;   
        oMe.opener = window.self;   
        oMe.close();   
    }   
     
    function LoginSucc(pc)   
    {      
        window.open("/portal/Portal.aspx?PassCode="+pc+"","BE_MAIN", "height=" + (window.screen.availHeight - 60) + ", width=" + (window.screen.availWidth - 14) + ", top=0, left=0, menubar=0, location=0, resizable=1, status=1");   
        setTimeout("DestroySelf()",100);   
  • 相关阅读:
    基于连通性状态压缩的动态规划问题
    2005年IT行业趋势Top10
    企业应用之性能实时度量系统演变
    云计算参考架构几例
    在CentOS上构建.net自动化编译环境
    Asp.net SignalR 实现服务端消息推送到Web端
    餐饮行业解决方案之客户分析流程
    餐饮行业解决方案之采购战略制定与实施流程
    餐饮行业解决方案之业务设计流程
    零售连锁专卖信息化解决方案简介之三
  • 原文地址:https://www.cnblogs.com/ice5/p/1374319.html
Copyright © 2011-2022 走看看