输入密码后默认回车提交登录事件

 

< div  class ="login_middle_name"  style ="margin-top:5px;" >
   码  < input  name ="txtPassWord"  type ="password"  id ="txtPassWord"  style ="border:1px solid #E2E2E2;width:110px; height:14px;"  onkeydown ="LoginSubmit()"   />
div >

 

function  submitLogin() {
    
var  txtUserCode  =  document.getElementById( " txtUserCode " );
    
var  txtPassWord  =  document.getElementById( " txtPassWord " );
    
var  SaveCookie  =  document.getElementById( " SaveCookie " );
    
var  LongLogin  =   " 0 " ;
    
if  (txtUserCode.value  ==   "" ) {
        window.alert(
" 请输入用户名! " );
        txtUserCode.focus();
        
return   false ;
    }
    
if  (txtPassWord.value  ==   "" ) {
        window.alert(
" 请输入密码! " );
        txtPassWord.focus();
        
return   false ;
    }
    
if  (SaveCookie.checked)
    {
        LongLogin 
=   " 1 " ;
    }
    window.location.href 
=   " user_login.aspx?fromUrl=index&UserCode= "   +  txtUserCode.value  +   " &PassWord= "   +  txtPassWord.value  +   " &LongLogin= "   +  LongLogin;
}

// 首页输入密码后默认回车提交登录事件
function  LoginSubmit()
  { 
            
if  (event.keyCode  ==   13
            { 
                event.keyCode 
=   9 ;
                event.returnValue 
=   false ;
                submitLogin();
            } 
     } 
 

 

你可能感兴趣的:(输入密码后默认回车提交登录事件)