By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,529 Members | 1,860 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,529 IT Pros & Developers. It's quick & easy.

Refreshing the parent page from the SECOND child

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.