方法一: var jmz = {}; jmz.GetLength = function(str) { ///获得字符串实际长度,中文2,英文1 ///要获得长度的字符串 var realLength = 0, len = str.length, charCode = -1; for (var i = 0; i < len xss=removed>= 0 && charCode <= 128)