0
我想限制用户打开我的应用程序的多个IFrame窗口。我的代码如下,window.open启动URL后返回null
<html>
<head>
<title>Test for Window Already Open</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
var gmyWin=null;
function myOpenWindow(winURL,winName,winFeatures,winObj)
{
var theWin;
theWin = window.open(winURL,winName,winFeatures);
// here theWin variable is null
return theWin;
}
</script>
</head>
<body>
<h1>Click this link to open the new window:</h1>
<p><a href='javascript:;' onClick='javascript:gmyWin=myOpenWindow("http://example:7001/tester/helloworld.jsp","myWin","height=630,width=1100",gmyWin);return false'>open new window</a> </p>
</body>
我尝试访问theWin变量,但它总是返回null。我想检查窗口是否打开,但我无法检查,打开URL后window.open返回null。 请帮我解决问题。
你为什么不使用window.location的? –