PDA

View Full Version : What's the JS code for closing a window....?



tralalala
07-28-2005, 02:58 PM
Well, I am maintaining a website, and I need some help...

What is the JS code for closing a window?

As in, at the top of the page there will be a link "Close Window". and when you click... it closes the window..


Can anyone help me out here?

Thanks,
Rafi

{I}{K}{E}
07-28-2005, 03:10 PM
<form method="post">
<input type="button" value="Close Window"
onclick="window.close()">
</form>


(does not work in Firefox)

tralalala
07-28-2005, 06:01 PM
Thanks :)

Could you also please tell me what the code is for going back (as in like clicking on the back button in the browser, but a button that says "Back" on it..)


Thanks a lot!! :D

Rick Phlegm
07-28-2005, 06:16 PM
I just use this link for that:

<a href="javascript:history.go(-1)">
There's probably a better way of doing it tho. :unsure:

{I}{K}{E}
07-28-2005, 06:30 PM
<form>
<input type="button" VALUE="Go back" onClick="history.go(-1)">
</form>