document.onkeydown = doSubmit; function doSubmit(){ if (window.event.keyCode==13) { form1.submit(); } }