Check Cap Locks | JavaScriptSource

Check Cap Locks

John Wang Mar 6, 2002

General

If a user enters his password in a Web-based form with [Caps Lock] accidentally on, he can become frustrated because his password is not being accepted, and may assume the script is the source of the problem. This script will let the user know his [Caps Lock] is on and about the potential for error.


Password:

Notes

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: checkCapLocks.js


Head

Paste this code into the HEAD section of your HTML document.


Body

Paste this code into the BODY section of your HTML document


Leave a Response

(7 comments)

Your question is beyond the scope of these comments. You will need to post it over on [a href="http://www.webdeveloper.com/forum/forumdisplay.php?f=3"]the JavaScript forum[/a]. Thanks!

Lee Oct 31, 2008

That's not a problem, that is the way it was designed to work. You can always adapt it to what you need.

Lee Oct 31, 2008

Hi ,[br /]The Main problem with ur script is checking only for the capitalized word not the caps lock button is pressed .

Narasimhan Oct 22, 2008

Hi[br /][br /]I'm italian so my english is not the best but i hope u 'll understand me[br /][br /]Your code is cool but when i apply it in my website there's an error: 'Object Required'[br /][br /]- I followed your instructions:[br /][br /]- I pasted scipt tags on the <head> tag[br /]I wrote onkeypress="checkcapslock(event)" on the textbox tag[br /][br /]can u help me?

Fabio Di Tommaso Oct 22, 2008

In order to better help you, you'll need to post your question [a href="http://www.webdeveloper.com/forum/forumdisplay.php?f=3"]over on the forums[/a].

Lee Jun 26, 2008