无法使用javascript访问父弹出div元素
我一直在写这个小脚本,翻译后的文本应该回到原来的位置。一切似乎都很好,但js仍然无法找到窗口对象。代码中有什么错误吗?我也试过newXWin.document,但没有用。请帮忙无法使用javascript访问父弹出div元素,javascript,jquery,html,Javascript,Jquery,Html,我一直在写这个小脚本,翻译后的文本应该回到原来的位置。一切似乎都很好,但js仍然无法找到窗口对象。代码中有什么错误吗?我也试过newXWin.document,但没有用。请帮忙 函数DoMagic() { var newWin=window.open(“https://translate.google.com/#auto/es/This%20is%20a%20test%20sentence.%0AI%20think%20I%20should%20try%20this.“,“newXWin”,
函数DoMagic()
{
var newWin=window.open(“https://translate.google.com/#auto/es/This%20is%20a%20test%20sentence.%0AI%20think%20I%20should%20try%20this.“,“newXWin”,“宽度=500,高度=600”);
}
函数GetText()
{
警报(window.opener.document.getElementById(“结果框”).innerHTML+“”);
}
我看不到任何地方定义了result\u box
。也许最好将var newWin设为全局变量,并在函数getText()中使用它。我看不到newWin在任何地方的使用了,这很奇怪…我看不到result\u box
在任何地方定义的可能重复。也许最好将var newWin设为全局变量,并在函数getText()中使用它。我看不出newWin还有什么用了,这很奇怪……可能是