if (event.keyCode == 13) { document.getElementById("form1").submit(); } function handler(tp){ if(tp=='ok'){ okFn(); } if(tp=='cancel'){ cancelFn(); } if(tp=='close'){ closeFn() } }