http://v.9-so.com/goods.php?id=8
这是目前测试的地址网站原系统是ecshop的现在模板里加了几个js文件
里面的main.js只要一加上就会和ecshop中的transport.js有冲突...
而刚才在其它帖子中有人提到解决方法为
"prototype对数组的扩展和你的for(i in array)语法造成冲突。"
听说是解决了,请问有哪位高手能够指教下如何处理?

解决方案 »

  1.   

    用别的循环来,直接用for(var i=0;i<xx;i++)这样冲突吗?这样还是冲突的话,那在引入prototype.js之前循环
      

  2.   

        Object.prototype.toJSONString = function () {
            var a = ['{'],  // The array holding the text fragments.
                b,          // A boolean indicating that a comma is required.
                k,          // The current key.
                v;          // The current value.        function p(s) {            // p accumulates text fragment pairs in an array. It inserts a comma before all
                // except the first fragment pair.            if (b) {
                    a.push(',');
                }
                a.push(k.toJSONString(), ':', s);
                b = true;
            }        // Iterate through all of the keys in the object, ignoring the proto chain.        for (k in this) {
                if (this.hasOwnProperty(k)) {
                    v = this[k];
                    switch (typeof v) {                // Values without a JSON representation are ignored.                case 'undefined':
                    case 'function':
                    case 'unknown':
                        break;                // Serialize a JavaScript object value. Ignore objects that lack the
                    // toJSONString method. Due to a specification error in ECMAScript,
                    // typeof null is 'object', so watch out for that case.                case 'object':
    if (this !== window)
    {
      if (v) {
      if (typeof v.toJSONString === 'function') {
      p(v.toJSONString());
      }
      } else {
      p("null");
      }
    }
                        break;
                    default:
                        p(v.toJSONString());
                    }
                }
            }          // Join all of the fragments together and return.        a.push('}');
            return a.join('');
        };
    这是ECSHOP本身那段JS的报错代码
    标记红色的就是报错位置.
    这个咋写?