当前位置: 代码迷 >> JavaScript >> JS登陆惯用效验
  详细解决方案

JS登陆惯用效验

热度:173   发布时间:2013-07-11 15:38:46.0
JS登陆常用效验
大写直接变小写
onblur="javascript:this.value=this.value.toLowerCase();"

键盘事件
 onkeypress ="detectCapsLock(event,'capStatus');"
function  detectCapsLock(e,divid){
   valueCapsLock  =  e.keyCode ? e.keyCode:e.which; // Caps Lock is on? 
   valueShift  =  e.shiftKey ? e.shiftKey:((valueCapsLock  ==   16 ) ? true : false ); // shift is press?
    if (((valueCapsLock >=   65   &&  valueCapsLock  <=   90 )  &&   ! valueShift) // Caps Lock is on and  shift not press 
    || ((valueCapsLock >=   97   &&  valueCapsLock  <=   122 )  &&  valueShift)) // Caps Lock is on and shift is press 
       document.getElementById(divid).style.display  =  'block';
    else 
       document.getElementById(divid).style.display  =  'none';
}
  相关解决方案