For example, on a "Save" button you want to prompt the user and ask them if they are sure they want to save the document. You can provide a client-side confirm popup on the onclick event. If the user presses "OK" you would return "true" and the server-side script would then proceed to be executed. If the user clicks "Cancel" you would return "false" and the server-side script would be prevented from being executed.
Here's a screen shot of the onclick event showing that there is a server-side simple action to save the document:
Here's a screen shot of the same onclick event, this time I clicked on the "Client" tab:
Here's the result when the button is clicked in the browser:
Read the full article at John Mackey's blog