因为这样写,this.options[index].value并不会换成+6,而是直接把this.options[index].value当成字符串来
你可以这样this.Tracker.value.replace( new RegExp('\\'+this.options[index].value,'g'),"");
 

解决方案 »

  1.   

    如果this.Tracker.value 的值是 3:1:6:2: 
    this.options[index].value为6: 
    this.Tracker.value.replace( new RegExp(this.options[index].value,'g'),"");
    这样写有没有错???
      

  2.   

    这样写有这个错误
    illegal character
    this.Tracker.value.replace( new RegExp( this.options[index].value,'g'),"");\n
    Line 1705
      

  3.   


    你加个this.options[index].value.toString啊,默认的转换估计是把整数当成unicode值了, 要不然""+this.options[index].value