473,324 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Child window calling a script loaded in parent...


Folks,

I have got this working before, in part with some help from this ng but
I never really understood how I got it working... and last time, I was
using it via a popup window as opposed to an IFRAME. I've got several
months of javascript under my belt and can resolve most things without
errors in my Mozilla Javascript Console, but this one just does not do
it for me.

This is the picture:

I have my 'parent' (main) window that contains a script - for test
purposes, its called myFunction(). It contains a simple hello world in
an alert call.

I have an IFRAME inside the parent. The IFRAME window is called winda2.

I want my IFRAME (thus, the child) to call myFunction from the parent
and my attempts thus far have failed.

From within my child window, I have done the following:

<script language="JavaScript" type="text/javascript">
window.opener.myFunction();
</script>

I've played with the above call and done variations of the above and get
the following messages in Mozilla Javascript Console:

Error: opener has no properties
Error: window.myFunction is not a function

and other similar type messages.

Can someone help point me in the right direction? It would be greatly
appreciated... please reply via the newsgroup so all can learn,

thanks
randell d.
Jul 23 '05 #1
2 4515
Randell D. wrote:

Folks,

I have got this working before, in part with some help from this ng but
I never really understood how I got it working... and last time, I was
using it via a popup window as opposed to an IFRAME. I've got several
months of javascript under my belt and can resolve most things without
errors in my Mozilla Javascript Console, but this one just does not do
it for me.

This is the picture:

I have my 'parent' (main) window that contains a script - for test
purposes, its called myFunction(). It contains a simple hello world in
an alert call.

I have an IFRAME inside the parent. The IFRAME window is called winda2.

I want my IFRAME (thus, the child) to call myFunction from the parent
and my attempts thus far have failed.

From within my child window, I have done the following:

<script language="JavaScript" type="text/javascript">
window.opener.myFunction();
</script>

I've played with the above call and done variations of the above and get
the following messages in Mozilla Javascript Console:

Error: opener has no properties
Error: window.myFunction is not a function

and other similar type messages.

Can someone help point me in the right direction? It would be greatly
appreciated... please reply via the newsgroup so all can learn,

thanks
randell d.

Found it...

From inside my IFRAME, I call the script that is loaded in the parent
window using

top.myFunction();
randelld
Jul 23 '05 #2
The Opener property will only work in floating windows. not in
iframes. Try using parent.myfunction() or top.myfunction()

--
Arik Segal
Tel-Aviv

On Thu, 17 Mar 2005 08:07:06 GMT, "Randell D."
<re************************@fiprojects.moc> wrote:

Folks,

I have got this working before, in part with some help from this ng but
I never really understood how I got it working... and last time, I was
using it via a popup window as opposed to an IFRAME. I've got several
months of javascript under my belt and can resolve most things without
errors in my Mozilla Javascript Console, but this one just does not do
it for me.

This is the picture:

I have my 'parent' (main) window that contains a script - for test
purposes, its called myFunction(). It contains a simple hello world in
an alert call.

I have an IFRAME inside the parent. The IFRAME window is called winda2.

I want my IFRAME (thus, the child) to call myFunction from the parent
and my attempts thus far have failed.

From within my child window, I have done the following:

<script language="JavaScript" type="text/javascript">
window.opener.myFunction();
</script>

I've played with the above call and done variations of the above and get
the following messages in Mozilla Javascript Console:

Error: opener has no properties
Error: window.myFunction is not a function

and other similar type messages.

Can someone help point me in the right direction? It would be greatly
appreciated... please reply via the newsgroup so all can learn,

thanks
randell d.


Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Reply Via Newsgroup | last post by:
Folks, I was sure this could be done - or at least sure I had seen reference to it at some point or other - but now, after having gone for a cup of tea, am begining to doubt my original belief....
8
by: CJack | last post by:
hy, I have an mdi application, i create a child form and I want to know when a button is pressed while that child form is loaded. I have this code: private void frmTestBaby_KeyUp(object sender,...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
1
by: wlevins | last post by:
I have a simple script which has worked flawlessly for years - it copies a bit of data from a child window down into a form field in the parent window that opened the child. But now in Firefox 2.0...
2
by: sangram | last post by:
i need a javascript for popup window and how to pass value to that new window from old window .
1
by: jd | last post by:
Hi guys, I'm trying to create an HTML page that contains two frames. The bottom frame should simply be some website, but the top frame needs to have a close link to kill the window. I tried calling...
1
by: nupuragr82 | last post by:
I have a parent form and on button click I am calling a child page where i have a textbox and a button. On button click of child form I am passing the value of the Textbox to the Textbox in parent...
4
by: Buddha | last post by:
Hello, I posted this on two forums, without too much help .. and I am kinda stuck in this. I need to refresh the parent page from the second child window which is opened by the first child and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.