// Example: // alert( readCookie("myCookie") ); var promo; function readCookie(name) { var cookieValue = ""; var search = name + "="; if(document.cookie.length > 0) { offset = document.cookie.indexOf(search); if (offset != -1) { offset += search.length; end = document.cookie.indexOf(";", offset); if (end == -1) end = document.cookie.length; cookieValue = unescape(document.cookie.substring(offset, end)) } } //alert(cookieValue); return cookieValue; } // Example: // writeCookie("myCookie", "my name", 24); // Stores the string "my name" in the cookie "myCookie" which expires after 24 hours. function writeCookie(name, value, hours) { var expire = ""; //if(hours != null) //{ expire = new Date((new Date()).getTime() + 10 * 3600000); expire = "; expires=" + expire.toGMTString(); //} document.cookie = name + "=" + escape(value) + expire + "; path=/;"; } lastScrollY = 0; function heartBeat() { diffY = document.body.scrollTop; //alert(diffY); percent =.1*(diffY-lastScrollY); if(percent>0) percent = Math.ceil(percent); else percent = Math.floor(percent); document.all.float.style.pixelTop+= percent; lastScrollY = lastScrollY+percent; } window.setInterval("heartBeat()",1); function hide(){ obj=document.getElementById("float"); obj.style.display='none'; } function show(){ obj=document.getElementById("float"); //position:absolute;right:1px;top:100;filter:alpha(opacity=50);z-index:99;width:140; obj.style.position='absolute'; obj.style.right='1px'; obj.style.top='100'; obj.style.filter='alpha(opacity=50)'; //obj.style.z-index='99'; obj.style.width='140'; obj.style.display=''; } function redraw(promo) { heartBeat(); //show(); tmp=readCookie("pro_str"); //alert(tmp); item_arr=tmp.split("###"); floatstr = ""+ ""+ "

"; //   隐藏 for(key in item_arr) { if (key){ //元素形如:2132|我的产品测试 //alert(item_arr[key]); tmp_info_arr=item_arr[key].split("|"); pid = tmp_info_arr[0]; names= tmp_info_arr[1]; if (pid && names){ ft = "|

"; floatstr = floatstr+ft; } } } floatstr = floatstr + "
   全部清空
"; float.innerHTML = floatstr; //alert(readCookie("subcat")); } function empty(){ var f1 = document.plist; for( var i=0;i1) { if(f1.compare[i].checked) { add(subcatid,pid,names,promo); } else { del(pid,names,promo); } } else { if(f1.compare.checked) { add(subcatid,pid,names,promo); } else { del(pid,names,promo); } //alert("对不起,该页只有一个产品时不能比较!"); //chkID.checked =false; } } function comparecheck(){ obj=document.compare; mark=0; for(k=0;k