如何从Javascript中的父级获取iframe中属性的值? [英] How can I get the value of an attribute inside an iframe from parent in Javascript?
问题描述
如何将属性值从 iframe 传递给父级?
How can I pass attribute value from iframe to parent?
即iframe (frame1) 具有 .如何在父页面中获取
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
这篇关于如何从Javascript中的父级获取iframe中属性的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!