• 【温故而知新-Javascript】窗口效果 (全屏显示窗口、定时关闭窗口)


    1.全屏显示窗口

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>全屏显示窗口</title>
    </head>
    
    <body>
    <div align="center">
    <input type="button" name="FullScreen" value="全屏显示"
    onclick="window.open(document.location,'big','fullscreen=yes')"  />
    </div>
    </body>
    </html>

    2.定时关闭窗口

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>定时关闭窗口</title>
    <script type="application/javascript">
    var i=6;
    clock();
    function clock()
    {
        document.title = "本窗口将在"+i+"秒后自动关闭!";
        i --;
        if(i>0) setTimeout("clock()",1000);
        else 
        {     
        // 1.在Firefox地址栏里输入 about:config
        // 2.在配置列表中找到 dom.allow_scripts_to_close_windows 
        // 3.点右键的选切换把上面的false修改为true即可。 
        //注:默认是false,是为了防止脚本乱关窗口
        //FireFox中做如此设置以后,直接使用"window.close()"即可对窗口关闭。
        
        //window.open('','_self','');针对chrome浏览器,添加此代码,不过我这测试没用,依然警告:Scripts may close only the windows that were opened by it. 
        window.close();
        }
    }
    </script>
    </head>
    
    <body>
    </body>
    </html>

    来源:《HTML、CSS、Javascript网页制作从入门到精通》15.3章节

    PS:IE下有效

  • 相关阅读:
    ABP记录被删除调用Repository.Get报错
    C# 中在对象后面跟“?” 以及在类型后面跟问号
    list转table
    ling groupby多字段分组统计
    linq一堆多再对多
    ABP下mvc的libs还原
    EF数据迁移
    ABP密码规则设置
    ABP中table时间格式化
    ABP读取appseting.json
  • 原文地址:https://www.cnblogs.com/yc-755909659/p/4062949.html
Copyright © 2020-2023  润新知