PDA

View Full Version : Caps Lock state


rrl
08-30-2002, 03:15 PM
With the ability to determine a screen resolution, a key press, etc... Is there a way to determine if the client's Caps Lock is on without using onKeyPress?...

Thanks in advance for any assist on this *s*

-Ron

whammy
08-30-2002, 11:51 PM
Not that I know of - however there must be some reason why you'd want to know this; and there are plenty of ways to prevent people from TYPING IN ALL CAPS, if that's what you're looking for.


<script language="javascript" type="text/javascript">
<!--
function NoShouting(str){
if(str.value == str.value.toUpperCase()){
alert("PLEASE TURN OFF YOUR \"CAPS LOCK\" KEY! - it's considered shouting!");
str.value = "";
}
}
// -->
</script>

<form name="blah">
<input type="text" name="sometext" onblur="NoShouting(this)" />
</form>


I might be on the wrong track here, since you didn't explain WHY you wanted to check for "CAPS LOCK".

Can you elaborate?