回车提交、连续点击、layer提示

简介: 1、回车提交 1 /*******************回车键提交***********************************/ 2 document.

1、回车提交

 1  /*******************回车键提交***********************************/
 2             document.onkeydown = function (e) {
 3                 var ev = document.all ? window.event : e;
 4                 if (ev.keyCode == 13) {
 5                     if ($(".ds_dialog").length > 0) {
 6                         return;
 7                     }
 8                     return CheckInput('txtUserName', 'txtCheckCode', 'lblError', 'hidErrCount');
 9                 }
10             }
View Code

2.连续点击、alert

 1 /*******************登录提交***********************************/
 2         var isEnabledClick = 0; //防止连续点击
 3         function CheckInput(txtUserName, txtCheckCode, lblError, txtErrCount){
 4             var paramUserName = document.getElementById(txtUserName).value;
 5             var paramCheckCode = document.getElementById(txtCheckCode).value;
 6             var lang = document.getElementById("lang").value;
 7             if (paramUserName.length <= 0) {
 8                 var errorMsg = lang == "en" ? "please input the User Name!" : "请输入用户名!";
 9                 layer.alert(errorMsg, {
10                     title: lang == "en" ? "Message reminding" : '消息提示',
11                     btn: [lang == "en" ? "yes" : "确定"]
12                 });
13                 $("#txtUserName").focus();
14                 return;
15             }
16 
17             var pwd = $("#txtPassWord").val();
18             if (pwd.length <= 0) {
19                 var errorMsg = lang == "en" ? "please input the User password!" : "请输入密码!";
20                 layer.alert(errorMsg, {
21                     title: lang == "en" ? "Message reminding" : '消息提示',
22                     btn: [lang == "en" ? "yes" : "确定"]
23                 });
24                 $("#txtPassWord").focus();
25                 return;
26             }
27             ///////////////
28             if (isEnabledClick == 0) {
29                 isEnabledClick = 1;
30                 $("#btnLogin").attr('disabled', "true");
31             }
32             else {
33                 var errorMsg = lang == "en" ? "Logging in, please later!" : "已经提交,请等待......";
34                 layer.alert(errorMsg, {
35                     title: lang == "en" ? "Message reminding" : '消息提示',
36                     btn: [lang == "en" ? "yes" : "确定"]
37                 });
38                 return;
39             }
40             setTimeout(function () {
41                 isEnabledClick = 0;
42             }, 3000);
View Code

 

目录
相关文章
|
4月前
input点击后placeholder中的提示消息消失
input点击后placeholder中的提示消息消失
|
10月前
|
JavaScript
点击提交按钮,提交所有生成的input参数
点击提交按钮,提交所有生成的input参数
46 0
|
10月前
点击增加按钮,添加input,超过三个则增加按钮隐藏
点击增加按钮,添加input,超过三个则增加按钮隐藏
82 0
|
10月前
layer小提示弹框验证
layer小提示弹框验证
45 0
|
前端开发 JavaScript 小程序
【‘极端’测试提的问题】输入栏填入表情图片需要进行异常处理
【‘极端’测试提的问题】输入栏填入表情图片需要进行异常处理
138 0
【‘极端’测试提的问题】输入栏填入表情图片需要进行异常处理
|
JavaScript
input 每输入一次都会失去焦点需要再次点击才能输入
出现上述问题其实就是遍历的时候key值绑定的不合理
256 0
|
存储 iOS开发
出现下图提示是什么原因呢?
iOS打包被拒,提示错误消息,账号有问题,呢是什么原因
SAP QM 事务代码QE01录入结果后回车,为啥不弹出Manual Valuation窗口?
SAP QM 事务代码QE01录入结果后回车,为啥不弹出Manual Valuation窗口?
SAP QM 事务代码QE01录入结果后回车,为啥不弹出Manual Valuation窗口?
|
开发工具 数据安全/隐私保护 git
git push时如果不再弹出用户和密码的输入提示框该怎么办
git push时如果不再弹出用户和密码的输入提示框该怎么办
355 0
git push时如果不再弹出用户和密码的输入提示框该怎么办
如何不让input输入框显示或禁止历史记录
如何不让input输入框显示或禁止历史记录
794 0