监理公司管理系统 | 工程企业管理系统 | OA系统 | ERP系统 | 造价咨询管理系统 | 工程设计管理系统 | 签约案例 | 购买价格 | 在线试用 | 手机APP | 产品资料
X 关闭
鹰潭网站建设公司

当前位置:工程项目OA系统 > 泛普各地 > 江西OA系统 > 鹰潭OA > 鹰潭网站建设公司

ecshop中jQuery冲突解决

申请免费试用、咨询电话:400-8352-114

鹰潭网站建设www.diyphp.net

<span style="COLOR: rgb(0,0,0)">首要就是Ecshop的AJAX传输类,transport.js 中重写了object的对象原型,然后招致了与jq框架的抵触。

<span style="COLOR: rgb(0,0,0)">处理:
1. 删除transport.js中587行 - 636行中关于object.prototype.toJSONString的界说
2. 自界说一个办法用于object对象的json序列化
如下

<span style="CURSOR: pointer" class="copyCodeText" onxxxxx="copyIdText('code_6038')">复制代码
  1. function obj2str(o)  
  2. {  
  3.   //开端  
  4.       var r = [];  
  5.    if(typeof o =="string") return "\""+o.replace(/([\'\"[url=file://\\])/g,]\\])/g,"\\$1").replace(/(\n)/g,"\\n").replace(/(\r)/g,"\\r").replace(/(\t)/g,"\\t")+"\[/url]"";  
  6.    if(typeof o =="undefined") return "undefined";  
  7.    if(typeof o == "object"){      
  8.     if(o===null) return "null";  
  9.     else if(!o.sort){  
  10.      for(var i in o)  
  11.       {    
  12.       if(i!="toJSONString") //添加判别,肃清对object原型的界说参加到json中  
  13.        r.push("\""+i+"\""+":"+obj2str(o));  
  14.       }  
  15.       r="{"+r.join()+"}";  
  16.      }else{  
  17.      for(var i =0;i<o.length;i++)  
  18.        r.push(obj2str(o))  
  19.       r="["+r.join()+"]"  
  20.      }  
  21.     return r;  
  22.     }  
  23.    return o.toString();  
  24.   //完毕     
  25. }   

<span style="COLOR: rgb(0,0,0)">3. 在模板页和js剧本中一切关于 obj.toJSONString()的当地,一概交换为obj2str(obj)

<span style="COLOR: rgb(0,0,0)">4. 重写好后发现compare.js, 首要重写个中的准时器 功用。 将以下代码交换到compare.js中

<span style="CURSOR: pointer" class="copyCodeText" onxxxxx="copyIdText('code_3094')">复制代码
  1. var Compare = new Object();  
  2. Compare = {  
  3.    add : function(goodsId, goodsName, type)  
  4.    {  
  5.     var count = 0;  
  6.     for (var k in this.data)  
  7.      {  
  8.       if (typeof(this.data[k]) == "function")  
  9.       continue;  
  10.       if (this.data[k].t != type) {  
  11.          alert(goods_type_different.replace("%s", goodsName));  
  12.         return;  
  13.        }  
  14.        count++;  
  15.      }  
  16.     if (this.data[goodsId])  
  17.      {  
  18.        alert(exist.replace("%s",goodsName));  
  19.       return;  
  20.      }  
  21.     else  
  22.      {  
  23.       this.data[goodsId] = {n:goodsName,t:type};  
  24.      }  
  25.     this.save();  
  26.     this.init();  
  27.    },  
  28.    init : function(){  
  29.     this.data = new Object();  
  30.     var cookieValue = document.getCookie("compareItems");  
  31.     if (cookieValue != null) {  
  32.       this.data = cookieValue.parseJSON();  
  33.      }  
  34.     if (!this.compareBox)  
  35.      {  
  36.       this.compareBox = document.createElement("DIV");  
  37.       var submitBtn = document.createElement("INPUT");  
  38.       this.compareList = document.createElement("UL");  
  39.       this.compareBox.id = "compareBox";  
  40.       this.compareBox.style.display = "none";  
  41.       this.compareBox.style.top = "200px";  
  42.       this.compareBox.align = "center";  
  43.       this.compareList.id = "compareList";  
  44.        submitBtn.type = "button";  
  45.        submitBtn.value = button_compare;  
  46.    this.compareBox.appendChild(this.compareList);  
  47.       this.compareBox.appendChild(submitBtn);  
  48.        submitBtn.onclick = function() {  
  49.         var cookieValue = document.getCookie("compareItems");  
  50.         var obj = cookieValue.parseJSON();  
  51.         var url = document.location.href;  
  52.          url = url.substring(0,url.lastIndexOf('/')+1) + "compare.php";  
  53.         var i = 0;  
  54.         for(var k in obj)  
  55.          {  
  56.           if(typeof(obj[k])=="function")  
  57.           continue;  
  58.           if(i==0)  
  59.              url += "?goods[]=" + k;  
  60.           else  
  61.              url += "&goods[]=" + k;  
  62.            i++;  
  63.          }  
  64.         if(i<2)  
  65.          {  
  66.            alert(compare_no_goods);  
  67.           return ;  
  68.          }  
  69.          document.location.href = url;  
  70.        }  
  71.        document.body.appendChild(this.compareBox);  
  72.      }  
  73.     this.compareList.innerHTML = "";  
  74.     var self = this;  
  75.     for (var key in this.data)  
  76.      {  
  77.       if(typeof(this.data[key]) == "function")  
  78.         continue;  
  79.       var li = document.createElement("LI");  
  80.       var span = document.createElement("SPAN");  
  81.        span.style.overflow = "hidden";  
  82.        span.style.width = "100px";  
  83.        span.style.height = "20px";  
  84.        span.style.display = "block";  
  85.        span.innerHTML = this.data[key].n;  
  86.        li.appendChild(span);  
  87.        li.style.listStyle = "none";  
  88.       var delBtn = document.createElement("IMG");  
  89.        delBtn.src = "themes/default/images/drop.gif";  
  90.        delBtn.className = key;  
  91.        delBtn.onclick = function(){  
  92.          document.getElementById("compareList").removeChild(this.parentNode);  
  93.         delete self.data[this.className];  
  94.          self.save();  
  95.          self.init();  
  96.        }  
  97.        li.insertBefore(delBtn,li.childNodes[0]);  
  98.       this.compareList.appendChild(li);  
  99.      }  
  100.     if (this.compareList.childNodes.length > 0)  
  101.      {  
  102.       this.compareBox.style.display = "";  
  103.       this.timer = window.setInterval("flowdiv('compareBox')", 50);  
  104.      }  
  105.     else  
  106.      {  
  107.       this.compareBox.style.display = "none";  
  108.        window.clearInterval(this.timer);  
  109.       this.timer = 0;  
  110.      }  
  111.    },  
  112.    save : function()  
  113.    {  
  114.     var date = new Date();  
  115.      date.setTime(date.getTime() + 99999999);  
  116.      document.setCookie("compareItems", obj2str(this.data));  
  117.    },  
  118.    lastScrollY : 0  
  119. }  
  120.   
  121. //用于准时器的主动滚动的层  
  122. lastScrollY=0;  
  123. function flowdiv(domid){  
  124.    var diffY;  
  125.      if (document.documentElement && document.documentElement.scrollTop)  
  126.       diffY = document.documentElement.scrollTop;  
  127.     else if (document.body)  
  128.       diffY = document.body.scrollTop  
  129.     else  
  130.       {/*Netscape stuff*/}  
  131.     //alert(diffY);  
  132.     percent=.1*(diffY-lastScrollY);   
  133.     if(percent>0) percent=Math.ceil(percent);   
  134.     else percent=Math.floor(percent);   
  135.      document.getElementById(domid).style.top=parseInt(document.getElementById(domid).style.top)+percent+"px";  
  136.     lastScrollY=lastScrollY+percent;   
  137.     //alert(lastScrollY);  
发布:2007-03-31 14:57    编辑:泛普软件 · xiaona    [打印此页]    [关闭]
鹰潭OA
联系方式

成都公司:成都市成华区建设南路160号1层9号

重庆公司:重庆市江北区红旗河沟华创商务大厦18楼

咨询:400-8352-114

加微信,免费获取试用系统

QQ在线咨询

泛普鹰潭网站建设公司其他应用

鹰潭软件开发公司 鹰潭门禁系统 鹰潭物业管理软件 鹰潭仓库管理软件 鹰潭餐饮管理软件 鹰潭网站建设公司