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

self.close and parent.location in one link

Hi All,
I have a problem with a simple (as I thought till now) thing:
I want to make a link in a child-window which would change site in the
parent-window and along with closing child window. The parent window
name is "main". A made a link like this in the child-site:

<a href="new_address.html" target="main" class="about"
onclick="javascript:main.location='new_address.htm l';self.close();">
change and close </a>

but it does not work.
I tried also window.close(), window.close(self) and alo put it all in
href instaed of onclick - without success. Although the page in "main"
changes to what I want, but the pop-up is still open.
Strange is that self.close() invoked without anything before it work
normally.

Do you have any idea how can I solve this problem?

Thanks in advance and best regards,
Michal
Sep 18 '08 #1
1 4421
SAM
mi**************@gmail.com a écrit :
Hi All,
I have a problem with a simple (as I thought till now) thing:
I want to make a link in a child-window which would change site in the
parent-window and along with closing child window. The parent window
name is "main".
What about are you talking when you say "parent" window ?
Are you in a framed page ?
(and you really talk of parent's frame or container of the frame)
A made a link like this in the child-site:
and ... what could be a "child-site" ?
<a href="new_address.html" target="main" class="about"
onclick="javascript:main.location='new_address.htm l';self.close();">
change and close </a>

but it does not work.
What is not working ?
You can't close a frame (or iframe), the more you can do is to hide it,
or to suppress it from main page's DOM tree.

If you're talking of framed page (frameset) it is something like :
onclick="parent.main.location = ...
or simply :
onclick="parent.location = ...
and you cant "close" the iframe or frame from its loaded file.
(in any case by 'self.close()' )
I tried also window.close(), window.close(self)
So youren't in a framed page and you're talking about *mother* and
*daughters* windows (popups), no ?

The 'mother' is the "opener" of the 'daughter' and not hers "parent"
In JS a 'parent' is always a 'container' and never an ancestor (previous
and independent object).

<a href="new_address.htm"
onclick="opener.location=this.href; self.close()">Modify</a>

The html target cant reach the 'opener', a target must be an html name
of something displayed in the same window (ie: another frame).

--
sm
Sep 18 '08 #2

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

Similar topics

2
by: Clive Moore | last post by:
I am using the following code to close a parent window. setTimeout('self.close()',1000); Is it posible to remove the confirm dialog? Thanks Clive --
4
by: Martin Herrman | last post by:
Hi all, I'm quite new to javascript. I'm using the following code: <a href="javascript: void(0)" OnClick="if(confirm('Are you sure you want to delete the following items? sv650.jpg,.'))...
1
by: Walter Beierdonck | last post by:
Hi, I've written a script dat has to run with a windows-shortcut... ex: http://www.domein.com/script.php This is my script: <html> <head> <script> var howLong = 2000;
4
by: Raymond Wilk | last post by:
I used javascript to open a new window, then used the following to close the new window on the next click: <body onBlur="self.close()" onClick="self.close()" bgcolor="#FFFFFF"> On the new window...
1
by: Steven | last post by:
I have a webpage where the user enters parameters for a report. This page then post to a 2nd page. In this second page is the code to create the report. The output of the page when it is...
4
by: stevong | last post by:
It works on Konquerer though. I remember it works on IE too. I've tried window.close() too. Doesn't work on Firefox also. I've also tried to create a function. It doesnt work on Firefox also....
1
by: oliver gargour | last post by:
Hello, I am using the following code in a popup. <html> <head> <title></title> </head> <body onLoad="this.focus();" onblur="self.close"> <form action="" method="get">
1
by: liu | last post by:
I have some thumbnails and once clicked it creates a new window. I don't want extra windows everywhere so I'd like it to auto-close when it's in the background. I've found <body...
5
by: zanzo | last post by:
I want to get to the parent location each time I'm adding a record. the problem is that i have a nested iframes, and each time the number of those is incremented: eg. at first adding record i...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.