$('lgname').focus();

$('lgname').onkeydown = function(){
if(event.keyCode == 13){
$('lgpwd').select(); //select 可以被focus 代替吗 为什么? }
}
$('lgpwd').onkeydown = function(){
if(event.keyCode == 13){
$('lgchk').select();
}
}
$('lgchk').onkeydown = function(){
if(event.keyCode == 13){
 chklg();
}
}---------------------------------------------------
function chklg(){
if($('lgname').value.match(/^[a-zA-Z_]\w*$/) == null){
alert('请输入合法名称');
$('lgname').select();
return false;
}
if($('lgname').value == ''){
alert('请输入用户名!');
$('lgname').focus();
return false;
}
if($('lgpwd').value == ''){
alert('请输入密码!');
$('lgpwd').focus();
return false;
}
if($('lgchk').value == ''){
alert('请输入验证码');
$('lgchk').select();     //这里的select可以被focus 代替吗  因为前面的是select
                             return false;
}
if($('lgchk').value != $('chknm').value){
alert('验证码输入错误');
$('lgchk').select();
return false;
}
count = document.cookie.split(';')[0];
if(count.split('=')[1] >= 3){
alert('因为您的非法操作,您将无法再执行登录操作');
return false;
}