function loginState(is) {
var msg = $("#submit_btn");
var count = 0;
var clear = is;
var pints_interval;
//触发定时器
pints_interval = setInterval(repeat, 500);
function repeat() {
if (clear) {
var mval = msg.val();
if (count < 3) {
count++;
mval += ".";
msg.val(mval);
}
else {
msg.val("登录");
count = 0;
}
} else if (!clear) {
if (pints_interval) {
clearInterval(pints_interval); //清除定时器
pints_interval = null;
}
}
}
}
loginState(true);函数传入true OR false 为什么先传入true启动定时器,之后传入false无法清除定时器
慕标琳琳
相关分类