求一段代码
判断文本框中的值中数字有多少 汉字有多少..然后相加
禁止使用for 谢谢咯 非常感谢 感谢咯.....
------解决方案--------------------
------解决方案--------------------
- JScript code
var a = "不1会2写3作a业b就c来d问e下f我4", reg = /[[\u4e00-\u9fa5]/g, bytes = a.match(reg).length + a.length; alert(bytes);
------解决方案--------------------
------解决方案--------------------
就是汉字占两个字节.然后数字字母占一个字节
- JScript code
var a = "不1会2写3作a业b就c来d问e下f我4", reg = /[[\u4e00-\u9fa5]/g, bytes = a.match(reg).length + a.length; alert(bytes);