I have this js function located in javascript.js. This code will be executed on the on the onkeydown method of each textbox on a page. What I want to happen is if the user presses down on the enter key, a confirmation box will appear, asking the user if they would like to save. If you click 'yes', then I would like the click event of the save button to be executed: click event of save button that I want to execute: protected void SaveButton_Click(object sender, EventArgs e) { } Code (markup): function in javascript.js file: //BASIC DETAILS PAGE function IPressedEnterBasic() { if(event.which || event.keyCode) { if ((event.which == 13) || (event.keyCode == 13)) { var save= confirm("Do you want to save?"); if (save == true) { document.getElementById("<%=SaveButton.ClientID%>").click(); } else { return false; } } } else { return true; } } Code (markup): Hopwever, at present the click event of the save button is not executed. If the 'yes' button on the confirmation box is clicked, the button that is currently on focus will be executed. How can I get the function to access the click event of the save button or alternativley set the save button to focus? Cheers