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 badges
Add a ment  | 

4 Answers 4

Reset to default 1

You 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