Syntax
onSubmit="command"
The onSubmit method of the Form property executes JavaScript code when a submit event occurs.
<html>
<head>
<title> Using the onSubmit event handler for the Form object</title>
</head>
<body>
<script language="JavaScript">
<!--
function confirm(){
alert("Your comments have been submitted. Thank you.");
}
-->
</script>
<form name="form1" onSubmit = 'confirm()'
<b>Enter Comments:</b>
<br>
<textarea name="comments" rows="5" cols="60"></textarea>
<br><br>
<input type = "submit" Value="Submit Comments">
</form>
</body>
</html>