zoukankan      html  css  js  c++  java
  • 消除window.close()的提示窗口

    Window.close()这句脚本是用来关闭当前窗口,如果是在window.open的窗口中执行Window.close(),将会很顺利 地将窗口关闭,但如果是在一非window.open打开的窗口中执行Window.close(),将会弹出一个提示窗口,如下:

    要在程序中消除这个提示框也很简单,不过在IE6和IE7稍有不同

    1. IE6

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>IE6Close</title>
        <script type="text/javascript">
        function closeWin()
        {
            window.opener=null;
            window.close();
        }
        </script>
    </head>
    <body>
        <form id="form2" runat="server">
        <div>
            <input id="btnClose" type="button" value="close"  onclick="closeWin()"/>
        </div>
        </form>
    </body>
    </html>

    2.IE7

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>IE7Colse</title>
        <script type="text/javascript">
        function closeWin()
        {
            window.open('','_self','');
            window.close();
        }
        </script>
    </head>
    <body>
        <form id="form2" runat="server">
        <div>
            <input id="btnClose" type="button" value="close" onclick="closeWin()"/>
        </div>
        </form>
    </body>
    </html>
  • 相关阅读:
    python的继承、封装、多态 --面向对象的特征
    ab压测工具简介
    dotnet core Console事件处理机制
    屹立千年,只为你一个回眸
    Derivative of the Sigmoid function
    Merge Overlapping Intervals
    Array of products
    Longest Peak
    javascript事件的注册方式总结
    纯css实现圆柱体-超简单!
  • 原文地址:https://www.cnblogs.com/jordan2009/p/2619771.html
Copyright © 2011-2022 走看看