admin管理员组文章数量:1388105
In my page i have iframe code. When i click particluar link that i frame window enabled.it is a form.when i submit the form i get some hidden field values.how can i access those values in my parent page?.
In my page i have iframe code. When i click particluar link that i frame window enabled.it is a form.when i submit the form i get some hidden field values.how can i access those values in my parent page?.
Share Improve this question asked Apr 20, 2011 at 13:23 Ravichandran JothiRavichandran Jothi 3,06611 gold badges55 silver badges83 bronze badges 4- Please show some code. Where are you submitting the form to? – Pekka Commented Apr 20, 2011 at 13:24
- <iframe name="signUp" id="signup" src="10.80.32.9:8080/app/appsignup.jsp" width="650" height="500"></iframe> ------------------------------------------------------------------------------ <script type="text/javascript"> var inter = setInterval(check,1000); function check(){ if(window.frames['signUp'].document.getElementById('registrationstatus').value == "ok"){ alert("wele"); document.getElementById('appclose').style.display='block'; clearInterval(inter); } } </script> – Ravichandran Jothi Commented Apr 20, 2011 at 13:27
- Sounds like stackoverflow./questions/5728620/… – Rudie Commented Apr 20, 2011 at 13:38
- Is there any possibility to return to the parent page url? – Ravichandran Jothi Commented Apr 20, 2011 at 14:43
2 Answers
Reset to default 3Since your iframe src= a plete url, and not a relative path (i.e: /app/appsignup.jsp) I am going to assume this Iframe exists at another IP or domain than the original page. If this assumption is correct, then you are not going to be able to modify the Iframe's DOM due to cross site scripting security rules in most browsers.
If the parent site, and child iframe exist on the same top level domain, then you can use document.getElementById("iframe_id")
Edit to answer second question:
You can add an onLoad event to the iframe, and so long as the iframe only has 1 form, and the page only changes when submitted, and this is where you want to be redirected.
Here is an example, but know this will redirect the first time and not work! What you will want to do is put a function in there, and then in the .js for that function check for the second onLoad...
<iframe name="signUp" id="signup" src="10.80.32.9:8080/app/appsignup.jsp"; width="650" height="500" onLoad="window.location('/index.html');">
You will not be able to access the iframe if it's on a different domain and/or port, as yours seem to be. The Same Origin Policy will prevent that.
There may be a workaround, depending on your use case. Maybe add some more details.
本文标签: phpHow to access child iframe elements from a parent javascript pageStack Overflow
版权声明:本文标题:php - How to access child iframe elements from a parent javascript page? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744529840a2610964.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论