Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html gwt-从iframe页面访问_Html_Gwt_Dom_Iframe - Fatal编程技术网

Html gwt-从iframe页面访问

Html gwt-从iframe页面访问,html,gwt,dom,iframe,Html,Gwt,Dom,Iframe,mainpage.html <html> <div id="123" name="foo"></div> <iframe src="/innerpage.html"></iframe> </html> innerpage.html: <html> and here is some GWT widget that needs to access

mainpage.html

<html>
<div id="123" name="foo"></div>
<iframe src="/innerpage.html"></iframe>
</html>

innerpage.html:

<html> 
 and here is some GWT widget that needs to access the div with id="123":
 DOM.getElementById("123").getAttribute("name") 
</html>

下面是一些GWT小部件,需要使用id=“123”访问div:
DOM.getElementById(“123”).getAttribute(“名称”)

可以在内部页面中访问主页上的div吗?您应该可以使用parent.getElementById(“123”)来实现这一点


请注意,innerpage和mainpage可能需要位于同一个域中,以防止将其标记为跨站点脚本。

使用jsni可以执行以下操作:


仅供参考--您不必将gwt部署为iframe…这也是一个好的观点,如果可以的话,我将直接将gwt部署到页面中,因为它还消除了其他麻烦。