我正在开发一个使用 windows.open(..) 打开弹出窗口的 Web 应用程序。我需要使用“window.open”返回的句柄在打开的窗口上调用一个函数,但我总是收到错误消息“addWindow.getMaskElements is not a function”,好像它无法访问声明的函数在子窗口上。这是 IE 和 FF 中的行为。我的代码如下所示:
function AddEmail(target,category)
{
if(addWindow == null)
{
currentCategory = category;
var left = getDialogPos(400,220)[0];
var top = getDialogPos(400,220)[1];
addWindow = window.open("adicionar_email.htm",null,"height=220px, width=400px, status=no, resizable=no");
addWindow.moveTo(left,top);
addWindow.getMaskElements ();
}
}
我已经用谷歌搜索并从不同的可靠来源阅读,显然这应该有效,但它没有。另一件事是,子窗口中的函数在 adicionar_email.htm 文件中包含的单独 .js 文件中声明。这有什么不同吗?它不应该.. 所以,如果有人遇到过类似的问题,或者知道我做错了什么,请回复此消息。提前致谢。
肯尼亚