Return Key

You can use the return key to submit a form instead of having a submit button. Enter some text in the example textbox and press the return key

Add onsubmit="return functionName()" to the forms opening tag and at the end of the function add return false

<script type="text/javascript">

function functionName(){

alert("This is the value you have entered in the text box\n\n"+document.forms["f1"]["t1"].value)

return false

}

</script>

<form name="f1" onsubmit="return functionName()">
<input type="text" value="" name="t1">
</form>