The method self.close can be used to close the current browser window in Java Script. This can be invoked on various events like click of a normal link, click of a button etc. The following examples show how to do that.

Close current window if a link is clicked:

<a href="javascript: self.close()">Close Window</a>

Close current window if a button is clicked:

<form method="post">
<input type="button" value="Close Window" onclick="window.close()">
</form>