<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head><meta forua="true" http-equiv="Cache-Control" content="max-age=0" /></head>
<card title="利用jQuery.cookie js 实现浏览历史记录示例" id="card1">
<p> 游客</p><p>
标题:利用jQuery.cookie js 实现浏览历史记录示例<br/>
正文:<br/>
先必须要引用一个js jquery.cookie.js <br/><br/>1，首先写入jsCookied <br/>代码如下:<br/>//浏览记录 写入JSCookied 开始 <br/>var img=$(&quot;#ProductImgurl&quot;).attr(&quot;jqimg&quot;); <br/>var name=$(&quot;#ProductDetail_ctl00_LabelName&quot;).text(); <br/>var url=location.href; <br/>var price=$(&quot;#ProductDetail_ctl00_LabelShopPrice&quot;).text(); <br/>var sellcount=$(&quot;#ProductDetail_ctl00_lblSaleNumber&quot;).text(); <br/>var hc=img+&quot;|&quot;+name+&quot;|&quot;+url+&quot;|&quot;+price+&quot;|&quot;+sellcount; <br/>if($.cookie(&quot;history&quot;)!=null) <br/>{ <br/>if($.cookie(&quot;history&quot;).indexOf(name)==-1) <br/>{ <br/><br/>$.cookie(&quot;history&quot;,hc+&quot;*&quot;+$.cookie(&quot;history&quot;),{expires:8,domain:'.groupfly.com',path:&quot;/&quot;}); <br/>} <br/>} <br/>else <br/>{ <br/>$.cookie(&quot;history&quot;,hc,{expires:8,domain:'.groupfly.com',path:&quot;/&quot;}); <br/>} <br/>//浏览记录 写入JSCookied 结束 <br/><br/>2，然后再读取Cookied <br/>代码如下:<br/>&amp;lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&amp;gt; <br/>//读取cookied历史记录 <br/>$(function(){ <br/><br/>var hc=$.cookie(&quot;history&quot;); <br/>if(hc!=null) <br/>{ <br/>if(hc.indexOf(&quot;*&quot;)!=-1) <br/>{ <br/>var splithtm<br/><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1216&amp;Page=1">[&lt;&lt;]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1216&amp;Page=1">[[1]]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1216&amp;Page=2">[2]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1216&amp;Page=3">[3]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1216&amp;Page=4">[&gt;&gt;]</a><br/>
<br/>
<a href="wap.asp?act=Com&amp;id=1216">查看评论(0)</a><br/>
<a href="wap.asp?act=AddCom&amp;inpId=1216">发表评论</a><br/><br/>

<br/>

<br/>
<a href="http://camnpr.com/wap.asp">首页</a>
</p>
</card>
</wml>