Click to See Complete Forum and Search --> : a sample javascript question?help me


mshen
11-22-2002, 12:36 PM
Hi Friends,

I just learn javascript.I have a sample here

http://24.112.27.16/page1.html

the page 2 window open when I click open page 2 in page 1.
and page 3 window open when I click open page 3 in page 2.

now I need a feature.I need the page 3 take place page 1 when I click open page 3 in page 2.and also the page2 close.

Please show me how to do it.Thanks so much.

I confuse to use window.location now.

Beach Bum
11-22-2002, 02:52 PM
OK, I am confused -

but if you want to replace a page (have one page replace another in its place) use

self.location.replace("xxxx.htm")

TheSpirit
11-22-2002, 03:31 PM
Originally posted by mshen
Hi Friends,

I just learn javascript.I have a sample here

http://24.112.27.16/page1.html

the page 2 window open when I click open page 2 in page 1.
and page 3 window open when I click open page 3 in page 2.

now I need a feature.I need the page 3 take place page 1 when I click open page 3 in page 2.and also the page2 close.

Please show me how to do it.Thanks so much.

I confuse to use window.location now.

Okay you want:
Page 1:
click "open page 2" to open it in a new window
Page 2:
click "open page 3" to open page 3 in Page 1's window and close Page 2's window.

I am rusty on the use of parent and self, but this MIGHT be how you could do that.

when the user clicks the "open page 3" button on page 2, try using:
parent.location.replace("page3.html") OR parent.location="page3.html"
AND
self.close()