首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

Firefox中出现异常 missing ( before formal parameters

2012-03-08 
Firefox中出现错误 missing ( before formal parametersfunction String.prototype.Trim(){return this.re

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() + "]") 

热点排行