OnKeyDown – Enter

textboxId.onkeydown = function(e) { 
if (!e) {
var e = window.event;
} // Enter is pressed
if (e.keyCode == 13) {
submitFunction
();
}
}