472,336 Members | 1,279 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,336 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 4258
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...
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...
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>...
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()"...
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...
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...
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">...
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...
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...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, 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.