當(dāng)前位置:工程項(xiàng)目OA系統(tǒng) > 泛普各地 > 江西OA系統(tǒng) > 鷹潭OA > 鷹潭網(wǎng)站建設(shè)公司
ecshop中jQuery沖突解決
申請(qǐng)免費(fèi)試用、咨詢(xún)電話(huà):400-8352-114
鷹潭網(wǎng)站建設(shè)
www.diyphp.net
<span style="COLOR: rgb(0,0,0)">首要就是Ecshop的AJAX傳輸類(lèi),transport.js 中重寫(xiě)了object的對(duì)象原型,然后招致了與jq框架的抵觸。
<span style="COLOR: rgb(0,0,0)">處理:
1. 刪除transport.js中587行 - 636行中關(guān)于object.prototype.toJSONString的界說(shuō)
2. 自界說(shuō)一個(gè)辦法用于object對(duì)象的json序列化
如下
- function obj2str(o)
- {
- //開(kāi)端
- var r = [];
- 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]"";
- if(typeof o =="undefined") return "undefined";
- if(typeof o == "object"){
- if(o===null) return "null";
- else if(!o.sort){
- for(var i in o)
- {
- if(i!="toJSONString") //添加判別,肅清對(duì)object原型的界說(shuō)參加到j(luò)son中
- r.push("\""+i+"\""+":"+obj2str(o));
- }
- r="{"+r.join()+"}";
- }else{
- for(var i =0;i<o.length;i++)
- r.push(obj2str(o))
- r="["+r.join()+"]"
- }
- return r;
- }
- return o.toString();
- //完畢
- }
<span style="COLOR: rgb(0,0,0)">3. 在模板頁(yè)和js劇本中一切關(guān)于 obj.toJSONString()的當(dāng)?shù)兀桓沤粨Q為obj2str(obj)
<span style="COLOR: rgb(0,0,0)">4. 重寫(xiě)好后發(fā)現(xiàn)compare.js, 首要重寫(xiě)個(gè)中的準(zhǔn)時(shí)器 功用。 將以下代碼交換到compare.js中
- var Compare = new Object();
- Compare = {
- add : function(goodsId, goodsName, type)
- {
- var count = 0;
- for (var k in this.data)
- {
- if (typeof(this.data[k]) == "function")
- continue;
- if (this.data[k].t != type) {
- alert(goods_type_different.replace("%s", goodsName));
- return;
- }
- count++;
- }
- if (this.data[goodsId])
- {
- alert(exist.replace("%s",goodsName));
- return;
- }
- else
- {
- this.data[goodsId] = {n:goodsName,t:type};
- }
- this.save();
- this.init();
- },
- init : function(){
- this.data = new Object();
- var cookieValue = document.getCookie("compareItems");
- if (cookieValue != null) {
- this.data = cookieValue.parseJSON();
- }
- if (!this.compareBox)
- {
- this.compareBox = document.createElement("DIV");
- var submitBtn = document.createElement("INPUT");
- this.compareList = document.createElement("UL");
- this.compareBox.id = "compareBox";
- this.compareBox.style.display = "none";
- this.compareBox.style.top = "200px";
- this.compareBox.align = "center";
- this.compareList.id = "compareList";
- submitBtn.type = "button";
- submitBtn.value = button_compare;
- this.compareBox.appendChild(this.compareList);
- this.compareBox.appendChild(submitBtn);
- submitBtn.onclick = function() {
- var cookieValue = document.getCookie("compareItems");
- var obj = cookieValue.parseJSON();
- var url = document.location.href;
- url = url.substring(0,url.lastIndexOf('/')+1) + "compare.php";
- var i = 0;
- for(var k in obj)
- {
- if(typeof(obj[k])=="function")
- continue;
- if(i==0)
- url += "?goods[]=" + k;
- else
- url += "&goods[]=" + k;
- i++;
- }
- if(i<2)
- {
- alert(compare_no_goods);
- return ;
- }
- document.location.href = url;
- }
- document.body.appendChild(this.compareBox);
- }
- this.compareList.innerHTML = "";
- var self = this;
- for (var key in this.data)
- {
- if(typeof(this.data[key]) == "function")
- continue;
- var li = document.createElement("LI");
- var span = document.createElement("SPAN");
- span.style.overflow = "hidden";
- span.style.width = "100px";
- span.style.height = "20px";
- span.style.display = "block";
- span.innerHTML = this.data[key].n;
- li.appendChild(span);
- li.style.listStyle = "none";
- var delBtn = document.createElement("IMG");
- delBtn.src = "themes/default/images/drop.gif";
- delBtn.className = key;
- delBtn.onclick = function(){
- document.getElementById("compareList").removeChild(this.parentNode);
- delete self.data[this.className];
- self.save();
- self.init();
- }
- li.insertBefore(delBtn,li.childNodes[0]);
- this.compareList.appendChild(li);
- }
- if (this.compareList.childNodes.length > 0)
- {
- this.compareBox.style.display = "";
- this.timer = window.setInterval("flowdiv('compareBox')", 50);
- }
- else
- {
- this.compareBox.style.display = "none";
- window.clearInterval(this.timer);
- this.timer = 0;
- }
- },
- save : function()
- {
- var date = new Date();
- date.setTime(date.getTime() + 99999999);
- document.setCookie("compareItems", obj2str(this.data));
- },
- lastScrollY : 0
- }
- //用于準(zhǔn)時(shí)器的主動(dòng)滾動(dòng)的層
- lastScrollY=0;
- function flowdiv(domid){
- var diffY;
- if (document.documentElement && document.documentElement.scrollTop)
- diffY = document.documentElement.scrollTop;
- else if (document.body)
- diffY = document.body.scrollTop
- else
- {/*Netscape stuff*/}
- //alert(diffY);
- percent=.1*(diffY-lastScrollY);
- if(percent>0) percent=Math.ceil(percent);
- else percent=Math.floor(percent);
- document.getElementById(domid).style.top=parseInt(document.getElementById(domid).style.top)+percent+"px";
- lastScrollY=lastScrollY+percent;
- //alert(lastScrollY);
- 1網(wǎng)站改版注意的問(wèn)題
- 2網(wǎng)站備案所需材料
- 3 企業(yè)四網(wǎng)合一網(wǎng)站升級(jí)版3
- 4PHP/MYSQL 查詢(xún)大數(shù)據(jù)/遍歷表
- 5ecshop的數(shù)據(jù)字典
- 6玩具租賃系統(tǒng)功能列表
- 7Linux系統(tǒng)平安Shell劇本用于Linux系統(tǒng)的平安初始化劇本
- 8網(wǎng)站建設(shè)和營(yíng)銷(xiāo)帶來(lái)的經(jīng)濟(jì)效益
- 9企業(yè)網(wǎng)站的優(yōu)化現(xiàn)狀
- 10網(wǎng)貸平臺(tái)主要運(yùn)營(yíng)模式主要有兩類(lèi)---債權(quán)轉(zhuǎn)讓模式
- 11企業(yè)為啥要求權(quán)威的網(wǎng)站維護(hù)單位做官方網(wǎng)站呢?
- 12世界看到你-----微信公眾平臺(tái)
- 13企業(yè)為啥要權(quán)威的網(wǎng)站建設(shè)公司做官網(wǎng)呢?
- 14p2p網(wǎng)貸系統(tǒng)可分為三部分
- 15網(wǎng)站制作絕對(duì)不可以犯的編程錯(cuò)誤
- 16玩具租賃電商平臺(tái)是什么
- 17關(guān)于HTML5當(dāng)時(shí)狀況的若干關(guān)鍵
- 18百度算法更新,為什么站被降權(quán)?
- 19如何讓您的網(wǎng)站盈利中發(fā)揮到極致
- 20魅妝社區(qū)項(xiàng)目開(kāi)發(fā)文檔
- 21有關(guān),PHP.ini 性能優(yōu)化
- 22房地產(chǎn)行業(yè)微信營(yíng)銷(xiāo)方案1
- 23上海天煜商業(yè)聯(lián)盟成功上線(xiàn)
- 24企業(yè)為什么偏愛(ài)須要專(zhuān)業(yè)的網(wǎng)站構(gòu)造單位做官方網(wǎng)站呢?
- 25PHP應(yīng)用中常見(jiàn)文件如何操作
- 26阿里云服務(wù)器年終六折瘋搶
- 27玩具租賃如何走出困境
- 28微信公眾平臺(tái)有什么好處
- 29有關(guān)MySQL分頁(yè)
- 30網(wǎng)站策劃的重要討論
成都公司:成都市成華區(qū)建設(shè)南路160號(hào)1層9號(hào)
重慶公司:重慶市江北區(qū)紅旗河溝華創(chuàng)商務(wù)大廈18樓