如何从Javascript中的父级获取iframe中的属性值?

如何从Javascript中的父级获取iframe中的属性值?

问题描述:

如何将iframe的属性值传递给父级?

How can I pass attribute value from iframe to parent?

即iframe(frame1)具有< a id ="a1" href ="http://www.infinitybusiness.net"> .如何在父页面中获取 href 的值?

I.e. iframe (frame1) has <a id="a1" href="http://www.infinitybusiness.net">. How can I get value of href in my parent page?

这是一个很好的教程,完全讨论了这一点: http://www.roseindia.net/java/pass-value-example/pass-value-from-iframe-parent.shtml

This is a great tutorial that talks exactly about that: http://www.roseindia.net/java/pass-value-example/pass-value-from-iframe-parent.shtml

仅当两个页面来自同一域时才可以使用它.跨域脚本也有许多解决方案..您可以在这里阅读更多内容: http://softwareas.com/cross-domain-communication-with-iframes

you can use it only if the two pages are served from the same domain. There are many solution for cross-domain scripting as well..you can read more here: http://softwareas.com/cross-domain-communication-with-iframes