...

View Full Version : calling function from iframe



RIK
11-09-2004, 06:25 PM
Hiya,

This should be straight-forward, but for some reason I have a severe case of the dumbs today and can't get it working:

I have an application component that uses an iframe to display online help topics. The content is generated by XML and XSL, then written to the body.innerHTML of the iframe document. To close the topic, users click a close button (also generated on the fly). The close button should set the display of the iframe to 'none'.

I can do that no problem from a link outside the iframe, but I can't figure out the right way to code button inside the iframe. The function being called is included in an external js file linked to the parent document of the iframe, but I can't get the syntax right to call the function from inside the iframe...

Oh - only has to work in IE 5.5+ (intranet so one supported browser.)

Thanks for any help.

Cheers,
RK

ca_redwards
11-09-2004, 06:49 PM
Hiya,

This should be straight-forward, but for some reason I have a severe case of the dumbs today and can't get it working:

I have an application component that uses an iframe to display online help topics. The content is generated by XML and XSL, then written to the body.innerHTML of the iframe document. To close the topic, users click a close button (also generated on the fly). The close button should set the display of the iframe to 'none'.

I can do that no problem from a link outside the iframe, but I can't figure out the right way to code button inside the iframe. The function being called is included in an external js file linked to the parent document of the iframe, but I can't get the syntax right to call the function from inside the iframe...

Oh - only has to work in IE 5.5+ (intranet so one supported browser.)

Thanks for any help.

Cheers,
RK

In your button's onclick property, perhaps try...


this.ownerDocument.parentWindow.close()

RIK
11-09-2004, 07:11 PM
Hiya,

As soon as I posted, the light came on, and I figured it out (very close to the suggested answer - thanks for that...)

Cheers,
RK



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum