function checkCapsLock( e ) {
var myKeyCode=0;
var myShiftKey=false;
var myMsg='Caps Lock is On.\n\nTo prevent entering your password incorrectly,\nyou should press Caps Lock to turn it off.';
// Internet Explorer 4+
if ( document.all ) {
myKeyCode=e.keyCode;
myShiftKey=e.shiftKey;
// Netscape 4
} else if ( document.layers ) {
myKeyCode=e.which;
myShiftKey=( myKeyCode == 16 ) ? true : false;
// Netscape 6
} else if ( document.getElementById ) {
myKeyCode=e.which;
myShiftKey=( myKeyCode == 16 ) ? true : false;
}
// Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on
if ( ( myKeyCode >= 65 && myKeyCode <= 90 ) && !myShiftKey ) {
alert( myMsg );
// Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on
} else if ( ( myKeyCode >= 97 && myKeyCode <= 122 ) && myShiftKey ) {
alert( myMsg );
}
}
INPUT TYPE="Password" NAME="Password" SIZE=16 MAXLENGTH=16 onKeyPress="checkCapsLock( event )"
Blogger templates
Blogger news
Blogroll
Archives
-
▼
2013
(219)
-
▼
July
(25)
- Form elements added by jquery not getting on the s...
- Sessions
- $_get() in php
- SQL: exists
- Php Error Control Operators
- Control structures in Php: return
- User logs out in php Penny Auction
- Security
- PHP File Uploading
- Assignment #7: User registration
- No title
- The History of PHP
- How to reset Mysql root pasword on Windows
- PHP foreach statement
- Php Tips
- Cake php Data validation
- How to use XMLHttpRequest
- While Loop in Php
- Reasons to Love PHP and MySQL
- The do while Statement
- Get result from database using a function SafDBFunc
- Javascript for checking Caps Lock is ON or OFF
- concatenation in php
- Php Comparison Operators
- PHP coding tips to write less code (If then else a...
-
▼
July
(25)