473,563 Members | 2,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_addre ss.html" target="main" class="about"
onclick="javasc ript:main.locat ion='new_addres s.html';self.cl ose();">
change and close </a>

but it does not work.
I tried also window.close(), window.close(se lf) 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 4460
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_addre ss.html" target="main" class="about"
onclick="javasc ript:main.locat ion='new_addres s.html';self.cl ose();">
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(se lf)
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_addre ss.htm"
onclick="opener .location=this. href; self.close()">M odify</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
13436
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
8363
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,.')) parent.location='index.php?option=modulemanager&module=11&suboption=show&suboption2=delete&ID3=,52&ID=21&gallerypage=1';">Delete selected items</a> ...
1
7889
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
1994
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 I want to place a link to another website, and I want the new window to open the link in ANOTHER new window (not the parent window) and then self...
1
3570
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 complete should open the report(in excel or snapshot) and then close the page. >From the prompt page the post looks like this: <FORM NAME='frmReportpr'...
4
14436
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. Bottomline is: Firefox doesn't accept window.close() or self.close()? Are there ways to rectify the issue? Please advise.
1
2571
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
2752
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 onBlur="self.close()" onClick="self.close()"to do the trick, but some windows are longer than 1 page that a user need to scroll the window to see it. With the...
5
3076
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 have the location like this: parent.location second: parent.parent.location third: parent.parent.parent.location how could i get to the initial...
0
7583
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7885
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7948
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6250
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
923
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.