473,416 Members | 1,565 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,416 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 3955
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.