原理 就是每次浏览产品时候存个cookie
在产品详细页面
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="../js/history.js"></script>
<script type="text/javascript" src="../js/jquery.cookie.js"></script>
<script type="text/javascript" src="..//public/jquery.json.js"></script>
<script type="text/javascript">
//存储一个记录
setHistory("goodshistory", { "keyname": "GoodsId", "data": { "GoodsName": "{%@rowgoods[EnglishName]%}", "GoodsId": "{%@rowgoods[GoodsId]%}", "CAS": "{%@rowgoods[CAS]%}" } });
读取的地方
<ul id="history">
<li><a style="color:#444;" href="{%~productview.html&gid=a['GoodsId']%}"><span>a['CAS']</span> a['GoodsName']</a></li>
</ul>
<script type="text/javascript">historylist("history", "history", "goodshistory", 6)</script>