/*
parameter:
length: Maximum length
ele: Enter the object
callBack: callback method, parameter len represents the number of bytes in the current input box, this in the method points to the ele pair
autoFire: Automatically call the initialization once
*/
function input_max(length, ele, showEle, callBack,autoFire){
if(){
('input', change, false);
}else{
('onpropertychange', function(){if( == "value"){alert('a');change()}})
}
function change(){
var len = (byteLength()/2);
len = len <= length ? len : length - len;
(ele,showEle,len);
};
function byteLength(b) {
if (typeof b == "undefined") { return 0 }
var a = (/[^\x00-\x80]/g);
return ( + (!a ? 0 : ))
};
//Auto call once
if(autoFire){change()};
};
// Callback function
function input_max_callBack(showEle,len){
var note = showEle;
if (len >= 0 ){
= len ;
= "";
= "";
}else{
= "<span class='red b fz_14'> exceeds" + -len + "</span>";
= "#FFC";
= "#F00";
}
}
// Dynamic title
input_max(30, ('news_title'), ('news_title_limit'),input_max_callBack,true);