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);   
  • 相关阅读:
    centos7之防止root密码被破解
    近期codeforces做题的总结?(不定期更新)
    小程序分享微信好友
    小程序自定义头部导航栏滑动颜色渐变
    小白快速上手的react.js教程
    架构型设计模式-同步模式
    仿vue-cli写一个简易的脚手架
    VUE基础知识篇-vue从零开始学VUE
    彻底理解Vue组件间7种方式通信
    设计模式--观察者模式
  • 原文地址:https://www.cnblogs.com/ice5/p/1374319.html
Copyright © 2011-2022 走看看