[英]How to get element from inside iframe
Hello I have iframe and in the iframe i need to get element of the parent window. 您好,我有iframe,在iframe中,我需要获取父窗口的元素。 How can i do it ?
我该怎么做 ?
index.html
child.html get parent element by id child.html通过id获取父元素
If you have var myVar
in the parent window, you can access it from the child window with window.parent.myVar
. 如果父窗口中有
var myVar
,则可以使用window.parent.myVar
从子窗口中访问它。
Note: this will only work if both child and parent are on the same domain. 注意:仅当父级和子级都在同一域中时,此选项才有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.