469,283 Members | 2,297 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,283 developers. It's quick & easy.

close a window

I open page 1 and page 2 from main page. I want to close page 2 from
page 1 after I finish processing some work in page 1. Does anyone
know how to do that?

Thanks,

Jenny
Jul 20 '05 #1
7 4974
DU
Jenny wrote:
I open page 1 and page 2 from main page. I want to close page 2 from
page 1 after I finish processing some work in page 1. Does anyone
know how to do that?

Thanks,

Jenny


Jenny, you need to give more details, explanations. Usually, in web
programming newsgroups such as this one, the *best* is to provide an url
so that regulars of this newsgroup and javascript experts can see the
page: these people can examine, understand your pages' logic as fast as
you can read the newspapers' headlines.

Here, I don't know if the opener opens page1 and then page1 opens page2
and how these pages are opened: automatically? via target attribute or
via window.open()? And if you opened these or 1 of the 2 with
window.open(), then how you coded all this.. etc.etc..

An url is best to figure this out or sufficient chunks of relevant code.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/

Jul 20 '05 #2
I'm assuming that page 1 is opening the page 2 and page 3. If this is the
case, then you could probably just get page 3 to call a function in page 1
to do the close other wise you will probably get a security error message as
you can't close a page from javascript on a page that didn't open the page
in the first place. Need user authorisation to proceed with it.

on page 3...

window.opener.myClose();

function myClose() {
page1.close();
}

Not easy to describe this, but I hope you get the idea.

Peter.

"DU" <dr*******@hotREMOVEmail.com> wrote in message
news:bf**********@news.eusc.inter.net...
Jenny wrote:
I open page 1 and page 2 from main page. I want to close page 2 from
page 1 after I finish processing some work in page 1. Does anyone
know how to do that?

Thanks,

Jenny


Jenny, you need to give more details, explanations. Usually, in web
programming newsgroups such as this one, the *best* is to provide an url
so that regulars of this newsgroup and javascript experts can see the
page: these people can examine, understand your pages' logic as fast as
you can read the newspapers' headlines.

Here, I don't know if the opener opens page1 and then page1 opens page2
and how these pages are opened: automatically? via target attribute or
via window.open()? And if you opened these or 1 of the 2 with
window.open(), then how you coded all this.. etc.etc..

An url is best to figure this out or sufficient chunks of relevant code.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/

Jul 20 '05 #3

"Jenny" <je***************@yahoo.com> wrote in message
news:b4**************************@posting.google.c om...
I open page 1 and page 2 from main page. I want to close page 2 from
page 1 after I finish processing some work in page 1. Does anyone
know how to do that?

Thanks,

Jenny

http://mosley.arach.net.au/test/windows.htm
Jul 20 '05 #4
Nice...but maybe you could help me....

I have also a window opener and a function like this...

function alert_message()
{
if(!popup && !popup.open && popup.closed) alert("Don't forget to
refresh!");
}

and I call that function from child window with:

body onunload="document.opener.alert_message()">

but I don't get alert message when I close a child window...

any suggestions ???

respect...

"Mosley Jones III" <me@info.gov.mars> wrote in message
news:3f********@funnel.arach.net.au...

"Jenny" <je***************@yahoo.com> wrote in message
news:b4**************************@posting.google.c om...
I open page 1 and page 2 from main page. I want to close page 2 from
page 1 after I finish processing some work in page 1. Does anyone
know how to do that?

Thanks,

Jenny

http://mosley.arach.net.au/test/windows.htm

Jul 20 '05 #5
"point" <po***@caanproduction.com> wrote in message
news:bf*********@enews2.newsguy.com...
<snip>
and I call that function from child window with:

body onunload="document.opener.alert_message()">

but I don't get alert message when I close a child window...

<snip>

opener is not a property of the document object, it is a property of the
global (window) object. So:-

onunload="opener.alert_message();"
-or-
onunload="window.opener.alert_message();"

- should work better.

Ricahrd.
Jul 20 '05 #6

"point" <po***@caanproduction.com> wrote in message
news:bf*********@enews2.newsguy.com...
Nice...but maybe you could help me....

I have also a window opener and a function like this...

function alert_message()
{
if(!popup && !popup.open && popup.closed) alert("Don't forget to
refresh!");
}

and I call that function from child window with:

body onunload="document.opener.alert_message()">

window.operner not document
but I don't get alert message when I close a child window...

any suggestions ???

respect...

"Mosley Jones III" <me@info.gov.mars> wrote in message
news:3f********@funnel.arach.net.au...

"Jenny" <je***************@yahoo.com> wrote in message
news:b4**************************@posting.google.c om...
I open page 1 and page 2 from main page. I want to close page 2 from
page 1 after I finish processing some work in page 1. Does anyone
know how to do that?

Thanks,

Jenny

http://mosley.arach.net.au/test/windows.htm


Jul 20 '05 #7
Hy guys...

thanx for the help...

I tried this:
onunload="opener.alert_message();"

and got the error: popup in undefined???

I opened a window using this:

function popUp(URL)
{
openwindow=window.open(URL, 'popup',
'toolbar=0,scrollbars=1,location=0,statusbar=0,men ubar=0,resizable=0,width=3
00,height=400,top=0,left=0');
}

respect...
"Richard Cornford" <ri*****@litotes.demon.co.uk> wrote in message
news:bf**********@titan.btinternet.com...
"point" <po***@caanproduction.com> wrote in message
news:bf*********@enews2.newsguy.com...
<snip>
and I call that function from child window with:

body onunload="document.opener.alert_message()">

but I don't get alert message when I close a child window...

<snip>

opener is not a property of the document object, it is a property of the
global (window) object. So:-

onunload="opener.alert_message();"
-or-
onunload="window.opener.alert_message();"

- should work better.

Ricahrd.

Jul 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by John H. | last post: by
9 posts views Thread by Graham | last post: by
5 posts views Thread by lindanr | last post: by
9 posts views Thread by Stan B | last post: by
2 posts views Thread by kurt sune | last post: by
6 posts views Thread by =?Utf-8?B?UGF1bA==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.