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

相关文章:

  • 2021-05-29
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
  • 2021-09-03
  • 2022-12-23
  • 2022-01-11
相关资源
相似解决方案