TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
pradeep kumar
NA
94
67k
Caps lock event not firing.
Dec 27 2012 1:33 AM
<script type="text/javascript">
function checkCapsLock(e) {
debugger;
if (!e)
e = window.event;
var fKeyCode = 0;
var myShiftKey = true;
var msg = 'You are pressing shift key or attempting to type in caps';
var myMsg = 'Caps Lock is On.';
if (document.all) {
fKeyCode = e.keyCode;
myShiftKey = e.shiftKey;
}
else if (document.layers) {
fKeyCode = e.which;
myShiftKey = (fKeyCode == 16) ? true : false;
}
else if (document.getElementById) {
fKeyCode = e.which;
myShiftKey = (fKeyCode == 16) ? true : false;
}
if ((fKeyCode >= 65 && fKeyCode <= 90) && !myShiftKey) {
alert(myMsg);
}
}
</script>
<asp:Login ID="Login1" runat="server" class="loginForm" OnAuthenticate="Login1_Authenticate">
<tr>
<td align="right">
<asp:Label ID="Label1" runat="server"></asp:Label>
</td>
<td>
<asp:TextBox ID="Password" runat="server" TextMode="Password" Width="150px" onClick="return checkCapsLock(e)"
Height="5px"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="log">*</asp:RequiredFieldValidator>
</td>
</tr>
</asp:login>
Im checking Caps lock on here i tried with onkeypress,onkeydown,onkeyup.., Java script is not firing if i use on click it showing error 'e' is undefined..
I really cant find where im missing...,
thanks in advance.
Reply
Answers (
8
)
Single Sign on for Microsoft 365 Without Active Directory
how to upload file using FTP? how to do in c# .net