JavaScript 的clearInterval 无效 清除不了。
if(rsCode=="DU"||rsCode=="DM"){//更改设备Down的颜色varHH=0;varmm=0;varss=0;varstr='';vardown...
if (rsCode=="DU"||rsCode=="DM") {
//更改设备Down的颜色
var HH = 0;
var mm = 0;
var ss = 0;
var str = '';
var downtimes = '';
var timeID = "";
timeID = setInterval(function () {
str = "";
if (++ss == 60) {
if (++mm == 60) {
HH++;
mm = 0;
}
ss = 0;
}
str += HH < 10 ? "0" + HH : HH;
str += ":";
str += mm < 10 ? "0" + mm : mm;
str += ":";
str += ss < 10 ? "0" + ss : ss;
downtimes = rsCode + str;
document.getElementById(objRs.LineId + objRs.EqId + 'Rs').innerHTML=downtimes;
}, 1000);
$("#" + objRs.LineId + objRs.EqId).css("fill", objRs.EqStatus);
$("#" + objRs.LineId + objRs.EqId + "Rs").show();
//$("#" + objRs.LineId + objRs.EqId + "Rs").text(objRs.ReasonCode);
}
else {
//更改设变状态颜色
clearInterval(timeID);
$("#" + objRs.LineId + objRs.EqId + "Rs").hide();
$("#" + objRs.LineId + objRs.EqId).css("fill", objRs.EqStatus);
$("#" + objRs.LineId + objRs.EqId + "Rs").text("");
} 展开
//更改设备Down的颜色
var HH = 0;
var mm = 0;
var ss = 0;
var str = '';
var downtimes = '';
var timeID = "";
timeID = setInterval(function () {
str = "";
if (++ss == 60) {
if (++mm == 60) {
HH++;
mm = 0;
}
ss = 0;
}
str += HH < 10 ? "0" + HH : HH;
str += ":";
str += mm < 10 ? "0" + mm : mm;
str += ":";
str += ss < 10 ? "0" + ss : ss;
downtimes = rsCode + str;
document.getElementById(objRs.LineId + objRs.EqId + 'Rs').innerHTML=downtimes;
}, 1000);
$("#" + objRs.LineId + objRs.EqId).css("fill", objRs.EqStatus);
$("#" + objRs.LineId + objRs.EqId + "Rs").show();
//$("#" + objRs.LineId + objRs.EqId + "Rs").text(objRs.ReasonCode);
}
else {
//更改设变状态颜色
clearInterval(timeID);
$("#" + objRs.LineId + objRs.EqId + "Rs").hide();
$("#" + objRs.LineId + objRs.EqId).css("fill", objRs.EqStatus);
$("#" + objRs.LineId + objRs.EqId + "Rs").text("");
} 展开
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询