document.onkeydown = function(evt){ var evt = window.event?window.event:evt; if (evt.keyCode==13) { $('#login-submit').click(); } } $(function(){ $('#login-submit').click(function(){ var pass = $('#login-pass').val(); $.post("{php echo $this->createMobileUrl('checklogin',array('rid'=>$rid))}", { pass:pass}, function(data){ if(data == 1){ $('#login-form').addClass("has-success"); window.location="{php echo $this->createMobileUrl('index',array('rid'=>$rid))}"; }else{ $('#login-form').addClass("has-error"); $('#login-form').transition('shake'); } }); }); });