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下只提示找不到文件。

  • 相关阅读:
    Outlook 邮件助手
    飞花令
    青蛙跳台阶
    如何提问,找到去说谎国的路
    如何计时一个小时十五分钟
    旋转数组的最小元素
    谁养鱼?
    小龙赚了多少?
    下一行是什么?
    5 = ?
  • 原文地址:https://www.cnblogs.com/helife/p/1921675.html
Copyright © 2011-2022 走看看