当前位置:网站首页>避免按钮重复点击的小工具bimianchongfu.queren()
避免按钮重复点击的小工具bimianchongfu.queren()
2022-07-01 08:26:00 【海宏AA】
按钮后台可能执行很长时间,这期间如果客户等不及再次点了按钮,可能会重复触发。
比如资产折旧,运行很长时间。

所以可以做一个hf_running的hiddenfield对象,设置值1表示正在运行,0表示没有。为兼容性用的纯js。
封装好了:
//避免重复运行,需要加一个hf_running的控件。用法:
//if (!bimianchongfu.queren('确认继续吗?')) return;
//执行具体业务代码
//执行完后,清空hf_running的值或者改成0
var bimianchongfu = {
kongjian: { objRunning: "hf_running" },
//检查是否正在运行,并提示,并设置值
queren: function (AConfirmMsg, lShowAlert, strShowAlert, lMarkIsRunning) {
var rt = this.zhengzaiyunxing(lShowAlert, strShowAlert, false);//检查正在运行
if (rt) return false; //正在运行,返回
//确认
var s = AConfirmMsg;
if (AConfirmMsg == undefined || AConfirmMsg == null) s = "";
if (s != "") if (!(rt = confirm(s))) return false;
//
if (lMarkIsRunning == undefined || lMarkIsRunning == null || lMarkIsRunning == true)
this.set("1");
//
return true;
},
//读取是否正在运行
zhengzaiyunxing: function (lShowAlert, strShowAlert, lMarkIsRunning) {
var obj = this.kongjian.objRunning, v = "", l = false, s = strShowAlert, lAlert = lShowAlert;
if (obj == undefined || obj == null) obj = document.getElementById("hf_running");
else if (typeof (obj) == "string") obj = document.getElementById(obj);
if (obj == undefined || obj == null) obj = document.getElementById("hf_running");
if (obj != null && this.kongjian.objRunning == null) this.kongjian.objRunning = obj;//记下来
v = obj.value; //取值
l = !(v == undefined || v == null || v == "" || v == "0" || v == "false");
//提示信息
if (l) { //正在运行
if (lShowAlert == undefined || lShowAlert == null) lAlert = true;
if (strShowAlert == undefined || strShowAlert == null) s = "正在运行,请稍候";
if (lAlert && s != "") alert(s);
} else { //没有运行,标记为正在运行
if (lMarkIsRunning == undefined || lMarkIsRunning == null || lMarkIsRunning == true)
this.set("1");
}
//完成返回
return l;
},
//设置值
set: function (val) {
var obj = this.kongjian.objRunning, tp = typeof (obj);
if (tp == "object") obj.value = val;
else if (tp == "string") document.getElementById(obj).value = val;
else document.getElementById("hf_running").value = val;
}
};边栏推荐
- Audio-AudioRecord create(一)
- On several key issues of digital transformation
- Embedded-c language-10-enumeration / (function) pointer (function) / multi-level pointer /malloc dynamic allocation / file operation
- 【无标题】
- Luogu p3799 demon dream stick
- [deep analysis of C language] - data storage in memory
- Leetcode t29: divide two numbers
- leetcode T31:下一排列
- [深度剖析C语言] —— 数据在内存中的存储
- 2022.2.15
猜你喜欢

Using settoolkit to forge sites to steal user information

Suivi des cibles de manoeuvre - - mise en oeuvre du modèle statistique actuel (modèle CS) filtre Kalman étendu / filtre Kalman sans trace par MATLAB

Burpsuite -- brute force cracking of intruder

【面试必刷101】链表

Internet of things technology is widely used to promote intelligent water automation management

OJ input and output exercise

seaborn clustermap矩阵添加颜色块
![[redis] it takes you through redis installation and connection at one go](/img/ca/89cb18f0eeb835f021d6a2489681a1.png)
[redis] it takes you through redis installation and connection at one go
![[JS reverse] MD5 encryption parameter cracking](/img/06/0610045d287f646479d6eb5021a067.png)
[JS reverse] MD5 encryption parameter cracking

机动目标跟踪——当前统计模型(CS模型)扩展卡尔曼滤波/无迹卡尔曼滤波 matlab实现
随机推荐
Rumtime 1200 upgrade: London upgrade support, pledge function update and more
防“活化”照片蒙混过关,数据宝“活体检测+人脸识别”让刷脸更安全
How can beginners correctly understand Google's official suggested architectural principles (questions?)
Properties of 15MnNiNbDR low temperature vessel steel, Wugang 15MnNiDR and 15MnNiNbDR steel plates
MAVROS发送自定义话题消息给PX4
The era of low threshold programmers is gone forever behind the sharp increase in the number of school recruitment for Internet companies
CPU设计实战-第四章实践任务一简单CPU参考设计调试
Codeworks round 803 (Div. 2) VP supplement
Leetcode T29: 两数相除
The use of word in graduation thesis
Li Kou 1358 -- number of substrings containing all three characters (double pointer)
Audio-AudioRecord create(一)
Conception et mise en service du processeur - chapitre 4 tâches pratiques
Model and view of QT
Utiliser Beef pour détourner le navigateur utilisateur
《微机原理》—总线及其形成
Programmer's regimen
使用 setoolkit 伪造站点窃取用户信息
Download jackson codehaus. org jar - downloading jackson. codehaus. org jar
Hijacking a user's browser with beef