zoukankan      html  css  js  c++  java
  • window.open测试:打开一个唯一的页面

    <html>
    <head>
    <title>JS window.open tester</title>
    </head>

    <script language="javascript">
    function jsOpenWindow() {
            var iRand = Math.round(Math.random()*1000000);
            var sURL = "Blank.html?ID=" + iRand.toString();
            var sHandle = iRand.toString();

            var oWin;
            try {
                oWin = window.open(sURL, sHandle, "");
            } catch (e) {
                alert("error");
            }
    }
    </script>

    <body>
    <input type="button" value="Open new window with unique ID" onclick="jsOpenWindow()"/>
    </body>
    </html>

    Blank.html:

    <html>
    <head>
        <title>Random Incident</title>
    </head>
    <body scroll="no">
        Random Incident
    </body>
    </html>

    说明:blank.html不存在,在IE下先弹出错误框,再弹出error,而在FF下只提示找不到文件。

  • 相关阅读:
    Java8新特性详解
    RedisTemplate详解
    RestTemplate详解
    windows中将多个文本文件合并为一个文件
    commons-lang 介绍
    commons-cli介绍
    commons-collections介绍
    commons-codec介绍
    commons-beanutils介绍
    commons-io介绍
  • 原文地址:https://www.cnblogs.com/helife/p/1921675.html
Copyright © 2011-2022 走看看