//实时监控字数


textareNum('#FashionStatement', WSW_COMMENT_NUM, '#statementRowChk', '#my-comment');

//实时监控字数

function textareNum(name, num, prompt, obj) {
$(name).val('');
var limitNum = num;
var pattern = '还可以输入' + limitNum + '字';
$(prompt).html(pattern);
$(name).keyup(
function() {
var remain = $(this).val().length;
if (remain > num) {
pattern = Wsw.msg.textareExceedNum;
$(prompt).css("color", "red");
_comment_stu2 = false;
if (obj) {
$(obj).children().find(".rw3").attr("class", "rw3 am-form-group wsw_text_xs wsw_border_red");
}
} else if (remain != 0) {
var result = limitNum - remain;
pattern = '还可以输入' + result + '字';
$(prompt).css("color", "#999999");
_comment_stu2 = true;
if (obj) {
$(obj).children().find(".rw3").attr("class", "rw3 am-form-group wsw_text_xs wsw_border_green");
}
} else if (remain == 0) {
if (obj) {
$(obj).children().find(".rw3").attr("class", "rw3 am-form-group wsw_text_xs");
}
}
$(prompt).html(pattern);
if (_comment_stu1 && _comment_stu2) {
if (obj) {
$(obj).children().find(".btu_confirm").attr("class", "am-modal-btn s2 btu_confirm wsw_text_greenBlue");
$(obj).children().find(".rw3").addClass("wsw_border_green");
}
} else {
if (obj) {
$(obj).children().find(".btu_confirm").attr("class", "am-modal-btn s2 btu_confirm wsw_text_red");
}
}
}
);


}

你可能感兴趣的:(//实时监控字数)