The onClick event is the most frequently used event type, which occurs when a user clicks the left button of the mouse. You can put your validation, warning etc., against this event type.
Example
You can try to run the following code to call a JavaScript function from an onClick event
Live Demo
<html>
<head>
<script>
<!--
function display() {
alert("Hello World")
}
//-->
</script>
</head>
<body>
<p>Click the following button and see result</p>
<form>
<input type="button" onclick="display()" value="Click me" />
</form>
</body>
</html>