admin管理员组文章数量:1387429
I have one page(say jobs.html) with an iframe loads another page( say joblist.html).There is one another popup(which displays description of job when clicks one title) which is generated with javascript will be load into the page in iframe when it loads. I have to load the popup(job description popup) outside the iframe. Any solution to get the jobs.html page's document body using javascript? or How can i get this popup outside the iframe?
Thanks,
I have one page(say jobs.html) with an iframe loads another page( say joblist.html).There is one another popup(which displays description of job when clicks one title) which is generated with javascript will be load into the page in iframe when it loads. I have to load the popup(job description popup) outside the iframe. Any solution to get the jobs.html page's document body using javascript? or How can i get this popup outside the iframe?
Thanks,
Share Improve this question asked Jul 28, 2011 at 6:22 Tinoy JamesonTinoy Jameson 4133 gold badges7 silver badges17 bronze badges4 Answers
Reset to default 1You can use the parent function.
You can define the function of showing the popup on the parent page. not in iFrame and call that function from iFrame.
Lets suppose you have a function of showing job description in Parent page.
var showJobDesc = function(jobTitle,jobDesc,...){
....
}
now in iFrame call this function like;
parent.showJobDesc(jobTitlem, jobDesc, ...);
By doing this you have no issues for placement/alignment of the Dialog.
I have to load the popup(job description popup) outside the iframe
What do you mean when you say load the popup outside the iframe
?
If you want to open the other page in a pop up, use window.open
If you want to open the new page replacing the parent's page, use the location
of the window
window.parent.location.href = "newPage.html"
In general, you can refer to the parent window (the window containing the iframe), use window.parent
(and therefore the parent window's document as window.parent.document
, and any script in the parent window as window.parent.scriptName
)
Put the show javascript into container page, and in the iframe just call parent.showpopup()
.
parent.showpopup() throws an access denied error. Kinda makes sense since including an iframe means the developer of the page can control the page it's contained in.
本文标签: javascriptHow to Show the Pop up in iframe outsideStack Overflow
版权声明:本文标题:javascript - How to Show the Pop up in iframe outside? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744493074a2608851.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论