472,989 Members | 2,992 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Refreshing the parent page from the SECOND child

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 the first child window closes after
opening the second child.

This is the second time I am typing the post, I lost all content
because the site complaine I was using the lesser than symbol.

Here is the code I wrote for this. the first child doesnt open the
second child in IE. however, in firefox, the first child does open the
second one but closes without even me writing code to close. Ofcourse,
it doesnt call the script on the parent page.

Parent :
--------------------------------------------------------------------------------

<a href="javascript:void(0);"NAME="My Window Name" title=" My title
here
"onKlick=window.open("child.html","Ratting","width =550,height=170,0,status=0,");>
Click here to open the child window</a>

--------------------------------------------------------------------------------
child :

--------------------------------------------------------------------------------

<script language="JavaScript">function goback()
{window.opener.location.reload("google.com");windo w.close();}</script>
and then called the function with a button open another window<a
href="javascript:void(0);"NAME="My Window Name1" title=" My title
here11
"onKlick=window.open("child2.html","Ratting","widt h=150,height=120,0,status=1");>Click
here to open the child window</a <input type="button" value="Close
this window" Onklick="goback()">

--------------------------------------------------------------------------------
child1 (this is saved as child2.html on my system):

--------------------------------------------------------------------------------

<script language="JavaScript">function goback()
{window.opener.location.reload("google.com");windo w.close();}</script>
and then called the function with a button on parent <input
type="button" value="Close this window" OnKlick="goback()">

--------------------------------------------------------------------------------
ofcourse the onklick is typo'd. Any help, appreciated
Jul 31 '08 #1
4 3927
On Jul 31, 6:17 am, Buddha <happybudd...@gmail.comwrote:
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 the first child window closes after
opening the second child.

This is the second time I am typing the post, I lost all content
because the site complaine I was using the lesser than symbol.

Here is the code I wrote for this. the first child doesnt open the
second child in IE. however, in firefox, the first child does open the
second one but closes without even me writing code to close. Ofcourse,
it doesnt call the script on the parent page.

Parent :
--------------------------------------------------------------------------------

<a href="javascript:void(0);"NAME="My Window Name" title=" My title
here
"onKlick=window.open("child.html","Ratting","width =550,height=170,0,status=0,");>
Click here to open the child window</a>

--------------------------------------------------------------------------------

child :

--------------------------------------------------------------------------------

<script language="JavaScript">function goback()
{window.opener.location.reload("google.com");windo w.close();}</script>
and then called the function with a button open another window<a
href="javascript:void(0);"NAME="My Window Name1" title=" My title
here11
"onKlick=window.open("child2.html","Ratting","widt h=150,height=120,0,status=1");>Click
here to open the child window</a <input type="button" value="Close
this window" Onklick="goback()">

--------------------------------------------------------------------------------

child1 (this is saved as child2.html on my system):

--------------------------------------------------------------------------------

<script language="JavaScript">function goback()
{window.opener.location.reload("google.com");windo w.close();}</script>
and then called the function with a button on parent <input
type="button" value="Close this window" OnKlick="goback()">

--------------------------------------------------------------------------------

ofcourse the onklick is typo'd. Any help, appreciated
If you have [as I understand it) any number of intermediate windows
and you want to close the main parent window from any of the [great-
grand-]children all you have to do is to pass a window name to the new
window that you are opening...
Then in you child you access the main window by name
mainParentWindow = window.open("", mainParentWindowName);
mainParentWindow.location="...";
Jul 31 '08 #2
On Jul 31, 2:23 pm, GArlington wrote:
On Jul 31, 6:17 am, Buddha wrote:
<snip>
> <a href="javascript:void(0);
Navigating to a javascript pseudo-protocol HREF does strange things in
Widows IE at least up until version 6. These include (but are not
limited to) stopping the playing of GIF animation, stopping changing
the displayed image when assigning to the - src - properties of IMG
elements and stopping acting on META REFRESH elements. Pretty much, if
javascript pseudo-protocol HREFs are activated on these browsers
nothing is guaranteed to work from that point on.

<snip>
>"width=550,height=170,0,status=*0,");>
^^^
There is nothing in the specified form for the third argument to the -
window.open - method that suggests that '0' would be a meaningful
value, and if the browser does not ignore it then it is likely to
cause problems.

<snip>
>ofcourse the onklick is typo'd.
Why?
Any help, appreciated

If you have [as I understand it) any number of intermediate
windows and you want to close the main parent window from
any of the [great- grand-]children all you have to do is
to pass a window name to the new window that you are opening...
With the exception of tacking the name onto a query string in the URL
for the new window, anywhere you can pass a name you can also pass an
object reference. Thus it might be better to pass the reference
instead as the use of that might avoid the possibility of the -
window.open - call re-opening a main window that had already been
closed by the user.
Then in you child you access the main window by name
mainParentWindow = window.open("", mainParentWindowName);
mainParentWindow.location="...";
Why not use whichever URL is assigned to - location - as the first
argument to - window.open - and not bother with the second javascript
statement?
Jul 31 '08 #3
SAM
Buddha a crit :
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 the first child window closes after
opening the second child.
in 2nd child (daughter which will close the mother) :

var mamy = opener.opener; // the grand mother
opener.close(); // kill 1st child (the mother)
mamy.document.body.innerHTML = 'hello'; // gran'ma says 'hello'


or if you prefer :

- in 1st child (the mother) :

daughter = window.open('2.htm','','width=300');
daughter.grd_mother = this.opener; // tell to daughter where is gran'ma
self.close(); // mother's auto close

- in 2nd child (the daughter) :

grd_mother.document.innerHTML = 'hello';
--
sm
Jul 31 '08 #4
Buddha wrote:
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 the first child window closes after
opening the second child.
[...]
This is the second time I am typing the post, I lost all content
because the site complaine I was using the lesser than symbol.
Do not use Google Groups for posting.
Here is the code I wrote for this. the first child doesnt open the
second child in IE. however, in firefox, the first child does open the
second one but closes without even me writing code to close. Ofcourse,
it doesnt call the script on the parent page.

Parent :
--------------------------------------------------------------------------------

<a href="javascript:void(0);"NAME="My Window Name" title=" My title
^^
here
"onKlick=window.open("child.html","Ratting","width =550,height=170,0,
^ ^ ^
status=0,");>
^^^
Click here to open the child window</a>
Eeek.

Make it Valid HTML first (yes, all of it; yes, you will have to learn
HTML for that), then deal with possibly remaining scripting issues.

<http://validator.w3.org/>
<http://diveintomark.org/archives/2003/05/05/why_we_wont_help_you>
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Jul 31 '08 #5

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

Similar topics

1
by: Pikolo Mondo | last post by:
hello, i've got a child window which will refresh the parent window after it closes heres the catch, if i use window.open() it works fine, but when i use window.showModelessDialog, the child window...
4
by: Sileesh | last post by:
Hi I have a btn in Parent.aspx page . On server_click() of the Btn, i am opening a new window called the child.apsx window. Child window also have a Btn. On serverClick of this Btn, I perform...
3
by: Mark | last post by:
I have a link on Parent.html which brings up Child.html in a separate browser window. Child.html has a button with Javascript to close itself. Is there a way I can cause Parent.html to be...
3
by: Iain | last post by:
How do I get a form to automatically refresh once (not continually using a timer). The scenario I have uses a parent table and a child table. (thanks to mmcarthy for indicating better termenology...
1
by: hashya | last post by:
Hi, I am opening window(child) from current window(parent). Now I want to keep refreshing child window from parent window. How can I achieve this. e.g. var win =...
1
by: Richard | last post by:
Greetings. I am total newbie to Javascript so what is written below is probably a bunch of cobblers!! Any assistance in correcting my code much appreciated. I wish the popped up child to pass...
0
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in...
1
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.