closing the frame with java onclick=window.close

They have: 5,633 posts

Joined: Jan 1970

I tried using the java close function but it is not working. Is it because I am using it in a frame?

I have a page that if you click on one link it opends a new browser that framed but when the viewer is finished I want them to be able to click on a button or link to close the new browser. I can't get it to work.. Any Help?

------------------
Gone Flying!

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Well first of all, pet peeve, but it's JavaScript, not Java. Java is a different programming language altogether.

As for the code to get a window to close, it's:

onClick="window.close()"

You have to have the parentheses.

hth,

Suzanne

------------------
Zero Cattle
Suzanne
Tables DeMystified

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Well, your e-mail reply address doesn't exist, so I can't answer your e-mail.

You can try using: window.mywindow.close()?

With frames the very handy JavaScript: The Definitive Guide from O'Reilly on page 251 explains the relationship such that parent.parent.close() or parent.close() (depending on the amount of frames) would close the window itself.

If window.mywindow.close() doesn't cut it (I didn't look at your frame structure), mywindow.close() parent.close() or parent.parent.close() may work.

Check out www.irt.org for more options.

Cheers,

Suzanne

------------------
Zero Cattle
Suzanne
Tables DeMystified

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.