If you've this...
<input type="button" value="Exit" onclick="JavaScript:window.location.href='../index'"/>
... there are couple ways to achieve this.
Both Chris & Sarfraz solutions work. What you can do as well is to add a confirm(...) dialog in the page's onbeforeunload event.
<html>
<body>
Click this button to go to Google's homepage.
<input type="button" value="Exit" onclick="window.location.href='http://www.google.com'">
<script type="text/javascript">
window.onbeforeunload = function() {
return "Are you sure?";
}
</script>
</body></html>
This will guarantee that, not only when the user clicks the Exit button, but also when s/he tries to navigate away from the page (For example, clicking the "Back" button in the browser.), onbeforeunload event will be triggered, and prompt the user to make sure s/he really wants to leave the page.
confirm(...) returns true if the user says "Yes, I want to leave the page."