[英] Access elements of parent window from iframe
我有一页我们可以打parent.php
.在这个页面中,我有一个iframe
和一个提交表单,除此之外,我还有一个id为"target"的div.是否可以在iframe中提交表单,并在成功时刷新目标div.比如在其中加载新页面或其他内容?
Edit: The target div is in the parent page, so my question is basically if you can make for an example a jQuery call outside the iframe to the parent. And how that would look?
编辑2:
$(;"form[name=my_form]").submit(function(e){
e.preventDefault;
window.parent.document.getElementById('#target');
$("#target").load("mypage.php", function() {
$('form[name=my_form]').submit();
});
})
I don't know if the script is active cause the form submits successfully but nothing happens to target.
Edit 3:
Now I'm trying to call the parent page from a link within the iframe. And no success there either:
<a href="javascript:window.parent.getElementById('#target').load('mypage.php');">Link</a>