Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: communicating from an "iframe" (2)


Message #1 by "Peter Byers" <pb@s...> on Sat, 27 Jul 2002 08:39:36
Chris
    Sadly "onload" is not an OK event for "iframe"

BUT

    You gave me a good clue "onfocus" is an OK event and it all works

Thanks Again
Pete (Northolt UK)


> Hi Pete,

>     Once again it seemed like a good idea the describe and demonstrate 
the
> question in a web page - the page is:-
>
>         http://217.72.167.102/PROBLEM2.HTM
>
>     Replies are awaited with baited breath.
> to unsubscribe send a blank email to


Managed to work out a way roud it, it seems you can't use window.parent to
grab a ref to the hta, so...

Add a function call to the onload event of your iframe:

<iframe id=Viewer src="test_sites.htm" onload='PassRef();'></iframe>

Pass a reference to the window(hta) to the iframe:

function PassRef(){
 document.frames[0].goParent=window;
}

In the child page, create a global variable that will be used to store this
reference and use it in your upDate function instead of window.opener:

var goParent;
function upDate() {
 goParent.document.forms.PAGE_NAME.HID_PAGE.value =
document.TRY_IT.IFRAME_INPUT.value;
 goParent.upDate();
}

HTH,

Chris



  Return to Index