日期:2014-05-16  浏览次数:20561 次

Firefox中出现错误 missing ( before formal parameters
function String.prototype.Trim()  
{  
  return this.replace(/^\\s*/g,"").replace(/\s*\$/g,"");  
}
错误行显示在这个函数上,是不是这种写法Firefox不支持?

------解决方案--------------------
这样就好了。
JScript code
String.prototype.Trim = function() {  
    return this.replace(/^\s*|\s*$/g,"");
}

alert("[" + " 123 ".Trim() + "]")