js判断中文字符长度

 就是 你把

String.prototype.len = function() 

return this.replace(/[^\x00-\xff]/g, "xx").length; 

放到你的 <Script></script>当中去,
然后你要判断长度的那里 就这么用

alert($("#文本框id").val().len()); 

就行了

posted @ 2017-04-22 14:44  jassy  阅读(406)  评论(0编辑  收藏  举报