日期:2014-05-16 浏览次数:20422 次
大写直接变小写 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'; }