输入密码时提示大写锁定已打开
2017-03-07 10:06
513 查看
1、扩展jQuery方法,在引入的jQuery的js中添加如下代码
2、在输入密码的页面添加如下js
3、效果
(function($){$.fn.extend({capsLockTip:function(){return this.each(function(){var ins=new $.CapsLockTip($(this));$(this).data(this.id,ins)})}});$.CapsLockTip=function(___target){this.target=___target;var _this=this;$(document).ready(function(){_this.target.bind("keypress",function(_event){var e=_event||window.event;var kc=e.keyCode||e.which;var isShift=e.shiftKey||(kc==16)||false;$.fn.capsLockTip.capsLockActived=false;if((kc>=65&&kc<=90&&!isShift)||(kc>=97&&kc<=122&&isShift))$.fn.capsLockTip.capsLockActived=true;_this.showTips($.fn.capsLockTip.capsLockActived)});_this.target.bind("keydown",function(_event){var e=_event||window.event;var kc=e.keyCode||e.which;if(kc==20&&null!=$.fn.capsLockTip.capsLockActived){$.fn.capsLockTip.capsLockActived=!$.fn.capsLockTip.capsLockActived;_this.showTips($.fn.capsLockTip.capsLockActived)}});_this.target.bind("focus",function(_event){if(null!=$.fn.capsLockTip.capsLockActived)_this.showTips($.fn.capsLockTip.capsLockActived)});_this.target.bind("blur",function(_event){_this.showTips(false)})});this.createTooltip=function(){if(null!=$.fn.capsLockTip.divTip)return $.fn.capsLockTip.divTip;$("body").append("<div id='divTip__985124855558842555' style='width:100px; height:15px; padding-top:3px; display:none; position:absolute; z-index:9999999999999; text-align:center; background-color:#FDF6AA; color:Red; font-size:12px; border:solid 1px #DBC492; border-bottom-color:#B49366; border-right-color:#B49366;'>大写锁定已打开</div>");$.fn.capsLockTip.divTip=$("#divTip__985124855558842555");return $.fn.capsLockTip.divTip};this.showTips=function(display){var divTip=_this.createTooltip();if(display){var offset=_this.target.offset();divTip.css("left",offset.left+"px");divTip.css("top",offset.top+_this.target[0].offsetHeight+3+"px");divTip.show()}else{divTip.hide()}};$.fn.capsLockTip.divTip=null;$.fn.capsLockTip.capsLockActived=null}})(jQuery);
2、在输入密码的页面添加如下js
//大写锁定提示 $("#password").capsLockTip();
3、效果
相关文章推荐
- 发布一个jquery插件--在Web下输入密码时提示大写锁定键(2012-05-03 10:20最后修改)
- 发布一个在Web下输入密码时提示大写锁定键的Jquery插件
- 在delphi中实现密码框“大写锁定打开”的提示
- 在delphi中实现密码框“大写锁定打开”的提示
- jquery插件--在input下输入密码时提示大写锁定键
- 在delphi中实现密码框“大写锁定打开”的提示
- 输入密码时检测大写是否锁定的js代码
- 输入密码检测大写是否锁定js实现代码
- Win7 打开访问共享目录时输入正确密码仍然提示密码错误
- js监控输入密码检测大写键盘是否锁定
- Ubuntu 锁定屏幕后即使输入正确密码也被提示密码错误导致无法解锁 问题的解决
- js监控输入密码检测大写键盘是否锁定
- 破解打开Excel文件编辑的时候提示受保护输入密码
- 输入密码时检测大写是否锁定的js代码
- 【凑数】输入密码大写锁定的检测
- SQL Server 2008打开输入sa密码提示无法登陆数据库的解决方法
- js实现的键盘开启大写锁定提示和密码显示与隐藏的效果
- 访问SharePoint站点用Office打开文档提示输入用户名和密码的解决方法
- app切换到后台一分钟后锁定,需要输入手势密码才能打开(程序锁)
- 【Discuz】打开网站提示Oops! System file lost: class/class_mysqli.php无法进入论坛与输入密码错误多次被禁止尝试