I am using this code to alert the user of an admin page that there is one more thing to do, 'does he want to go to that page now?' confirm/cancel. function CheckLeave(){ if(window.event) { window.event.returnValue = "Would you like to mark this vehicle as sold?"; parent.location="admin2.asp?linkID=<%=thisID%>"; } } Code (markup): in the body tag I have: on onbeforeunload="CheckLeave()" Code (markup): which is fine for this purpose. My problem is am not sure how to do one thing if he confirms and another if he cancels. ??