Refreshing the parent page from the SECOND child

B

Buddha

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");window.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","width=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");window.close();}</script>
and then called the function with a button on parent <input
type="button" value="Close this window" OnKlick="goback()">
 
G

GArlington

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");window.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","width=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");window.close();}</script>
and then called the function with a button on parent <input
type="button" value="Close this window" OnKlick="goback()">

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="...";
 
H

Henry

On Jul 31, 6:17 am, Buddha wrote:

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.

^^^
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.

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?
 
S

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';
 
T

Thomas 'PointedEars' Lahn

Buddha said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top