//獲取字符長度
String.prototype.getBytes = function()
{
var cArr = this.match(/[^\x00-\xff]/ig);
return this.length + (cArr == null ? 0 : cArr.length);
}
val.getBytes() > 60
alert('val不能超過60個字符或30個漢字');
posted on 2010-08-12 17:48
David1228 閱讀(319)
評論(0) 編輯 收藏 所屬分類:
JavaScript