[color=red][b]1.去除前后的空格[/b][/color]
strip:function(){
return this.replace(/^\s+/, '').replace(/\s+$/, '');
}
[color=red][b]2.判断中文的长度[/b][/color]
String(val).replace(/[^\x00-\xff]$/g,"ci").length
还可以用charCodeAt(index)与255进行比较
strip:function(){
return this.replace(/^\s+/, '').replace(/\s+$/, '');
}
[color=red][b]2.判断中文的长度[/b][/color]
String(val).replace(/[^\x00-\xff]$/g,"ci").length
还可以用charCodeAt(index)与255进行比较