1 function strLength(str) { 2 var a = 0; 3 for (var i = 0; i < str.length; i++) { 4 if (str.charCodeAt(i) > 255) 5 a += 2;//按照预期计数增加2 6 else 7 a++; 8 } 9 return a; 10 } 11 12 13 获取url中的参数 14 15 16 function GetQueryStringRegExp(name,url) { 17 var reg = new RegExp("(^|\?|&)" + name + "=([^&]*)(\s|&|$)", "i"); 18 if (reg.test(url)) return decodeURIComponent(RegExp.$2.replace(/+/g, " ")); return ""; 19 }