473,394 Members | 1,867 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,394 software developers and data experts.

How will Child Window[called using window.open] Call Functions in Parent Window

Hi!
I just want to ask if it possible to call functions in parent window if the child window is created.
Below is sample:
//--------------------------------------------------------------------------------//
<html>
<head>
<title></title>
<script language="JavaScript">
var win;

function popup()
{
win = window.open("popup.html", "test", "status=0");
win.document.write("<input type='button' value='child click' onclick='popup2()'>");

win.document.close();
}

function popup2()
{
alert('true');
}

</script>
</head>
<body>
<input type='button' value='parent click' onclick='popup()'>
</body>
</html>

//--------------------------------------------------------------------------------//

Once 'parent click' button is clicked, popup.html will show that contain 'child click' button.
All I want is that once 'child click' button is clicked, I want to call function popup2() created in the parent window.

Please help for additional information I missed. Thanks in advance!
Nov 9 '06 #1
2 9824
vee10
141 100+
hi,

just write

win.document.write("<input type='button' value='child click'
onclick='opener.popup2()'>");

then popup2() in the child window will be called but this alert box will be appeared in the parent window if u want appear in the child window then write

function popup2()
{
win.alert('true');
}

then alert will be appeared in the child window
















Hi!
I just want to ask if it possible to call functions in parent window if the child window is created.
Below is sample:
//--------------------------------------------------------------------------------//
<html>
<head>
<title></title>
<script language="JavaScript">
var win;

function popup()
{
win = window.open("popup.html", "test", "status=0");
win.document.write("<input type='button' value='child click' onclick='popup2()'>");

win.document.close();
}

function popup2()
{
alert('true');
}

</script>
</head>
<body>
<input type='button' value='parent click' onclick='popup()'>
</body>
</html>

//--------------------------------------------------------------------------------//

Once 'parent click' button is clicked, popup.html will show that contain 'child click' button.
All I want is that once 'child click' button is clicked, I want to call function popup2() created in the parent window.

Please help for additional information I missed. Thanks in advance!
Nov 9 '06 #2
Thanks for the reply.

Is it possible also to have a javascript function handling "opener.someFunctions()". For instance, I have lots of buttons calling function upon onclick and since string inside win.document.write("some string here....") is also dynamically generated.

What I mean is that, on the parent window, there’s a lot of win.document.write("<input type='button' value='click me2!' onclick='someFunctions()'>") and inside child window, there must be a code that generates "opener.someFunctions()".

Is there any way to have javascript code for the child window to make it?

I appreciate for responses. Thanks in advance.
Nov 9 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Filiz Duman | last post by:
Is it possible to call a javascript function based in the parent window from the child window ? I do open a pop up window from the parent window with: newwindow = window.open (...) and assign...
2
by: John Dalberg | last post by:
I have a closed box system which opens an html page. The page closes by the system. I have access to the html page. I added code to open a child window from this page. However when the parent...
8
by: mike | last post by:
I have a parent window where I open a child window. In that child window I have some js that creates a row in the parent window, it looks like: if ( self.opener.document.update ) { var...
2
by: Raj | last post by:
Hi All, I have a problem with trying to refresh the parent window from child window in order to update data in the parent window. The sequence of events are 1) I click a button in the parent...
5
by: midnight_use_only | last post by:
hi all, quick question, how do you submit a form to a parent window from a child popup window? i have the following and all online documentation *suggests* that it should work but it does NOT: ...
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...
1
by: jennyzest4u | last post by:
Hi, I 'm trying to access some fields in the parent window from a child window like this.. Here is my parent Jsp, which has the following script.. if (window.opener.parent.frames) { var...
1
by: bhargavi ramineni | last post by:
I have used the following javascript code to get a child window for parent window. childWin...
8
by: Randell D. | last post by:
Folks, I have a script that pops a calendar up - its a generic script that I use across some of my webapps - I would like the script to be intelligent enough to set its fonts and other colours to...
5
by: BibhuAshish | last post by:
Hello, I have one child window. in child window i am selecting one radio button. i want to return that selected value to parent window. To open child window in parent window, i have written like...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.