var authentication = { objId : null, objPassword : null, init : function(idTextInput, passWordInput) { this.objId = idTextInput; this.objPassword = passWordInput; this.objId.onkeydown = function() { if (event.keyCode == 13) authentication.objPassword.focus(); }; this.objPassword.onkeydown = function() { if (event.keyCode == 13) authentication.login(); }; }, login : function() { if (this.check()) { this.objId.form.submit(); } }, check : function() { if (this.objId.value == '') { alert("Enter User ID."); this.objId.focus(); return false; } if (this.objPassword.value == '') { alert("Enter User Password."); this.objPassword.focus(); return false; } return true; } };