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