<html> <body> <form name="form1" method="post" action="" onsubmit="alert('The form is being submitted')"> <input type="text" name="textfield"> <input type="submit" value="Submit"> </form> </body> </html>