日期:2014-05-20 浏览次数:20682 次
if (pos > -1) {
if (arg.split(".")[1].length>decimal_length) {
errorMsg = title+"小数点后最多可输入"+decimal_length+"个数字";
alert(errorMsg);
return false;
}
}
var Filter = {
doFilter: function(str){
if(!str
------解决方案--------------------
typeof str !== 'string')return str;
for(var i = 0, len = this._filters.length; i < len; i++){
str = str.replace(this._filters[i], "");
}
return str;
},
_filters: [//private
/\/\*(?:.
------解决方案--------------------
\n)*?\*\//g,
/\/\/.*/g,
/<\!--(?:.
------解决方案--------------------
\n)*?-->/g
]
},
getter = /['"](?:.
------解决方案--------------------
\n)*?[^\x00-\xff](?:.
------解决方案--------------------
\n)*?['"]/g;
var testStr = "//测试\n" +
"var x = 1;\n" +
"/**\n" +
"中文\n" +
"*/\n" +
"<!--<span>测试中文</span>\n-->\n" +
"var y = '中文变量';\n" +
"var z = '变量加' + x + y\n";
testStr = Filter.doFilter(testStr);
var zhStr = testStr.match(getter);