<span style="color: rgb(51, 51, 0);">
function TextNumCheck(elem) {
this.elem = document.getElementById(elem);
}
TextNumCheck.prototype = {
text:function (obj, string) {
return obj.innerText ? obj.innerText = string : obj.textContent = string;
},
animBg:function (obj) {
setTimeout(function () {
obj.style.backgroundColor = "#fe9900";
setTimeout(function () {
obj.style.backgroundColor = "#fff";
}, 150);
}, 250);
},
curNum:function (alrElem) {
var obj = document.getElementById(alrElem);
var s = this.elem.value.length;
this.text(obj, s);
return this;
},
numRemain:function (remainELem, maxNum) {
var obj = document.getElementById(remainELem);
var _thisElem = this.elem;
var s = _thisElem.value.length;
if (typeof maxNum === "undefined") {
maxNum = 500;
}
var remain = maxNum - s;
if (remain < 0) {
_thisElem.value = _thisElem.value.substring(0, maxNum);
this.animBg(_thisElem);
}
this.text(obj, remain);
return this;
}
};
var txtNumCheck = new TextNumCheck("cErr_con");
document.getElementById("cErr_con").onkeyup = function () {
txtNumCheck.curNum("lim_alreay").numRemain("lim_remain");
};
</span>