惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
云风的 BLOG
云风的 BLOG
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Palo Alto Networks Blog
D
Docker
H
Hackread – Cybersecurity News, Data Breaches, AI and More
S
Schneier on Security
Engineering at Meta
Engineering at Meta
I
InfoQ
L
LangChain Blog
Cyberwarzone
Cyberwarzone
T
Tenable Blog
WordPress大学
WordPress大学
P
Privacy & Cybersecurity Law Blog
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Jina AI
Jina AI
C
CERT Recently Published Vulnerability Notes
Scott Helme
Scott Helme
博客园 - 三生石上(FineUI控件)
酷 壳 – CoolShell
酷 壳 – CoolShell
Know Your Adversary
Know Your Adversary
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Last Watchdog
The Last Watchdog
Last Week in AI
Last Week in AI
Cloudbric
Cloudbric
S
SegmentFault 最新的问题
爱范儿
爱范儿
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 叶小钗
AI
AI
T
Tor Project blog
I
Intezer
T
Threatpost
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
Visual Studio Blog
N
News and Events Feed by Topic
Latest news
Latest news
S
Security Affairs
博客园 - Franky
Microsoft Security Blog
Microsoft Security Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
B
Blog RSS Feed
C
Cybersecurity and Infrastructure Security Agency CISA
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
S
Securelist

博客园 - 愛如風過

MODRD 指令 读取地址是哪儿来的 如何在不同编程语言中获取现在的Unix时间戳(Unix timestamp)? easyui datagrid 的分页刷新按钮 HttpRequest Get Post,WebClient Get GetWindowThreadProcessId用法(转) EASYUI DATAGRID 多列复选框CheckBox Android Service 数据库主键设计之思考[转] Silverlight 使用用户控件 [转] - 愛如風過 技巧:在Silverlight 2应用程序中切换用户控件[转] Jquery获取设置radio select checkbox 文本框 [转] - 愛如風過 泛型 Vista 中,使用VS 2005调试程序没有权限的问题? Team Foundation 和 Visual SourceSafe 之间的区别 MSF资源 网页左右浮动广告(包括ASP.NET后台管理) why? 在水晶报表中实现任意选择指定字段显示资料 .在Datagrid中修改数据,当点击编辑键时,数据出现在文本框中,怎么控制文本框的大小 ?(转)
Jquery 实现“最近浏览过的商品”的功能 - 愛如風過 - 博客园
愛如風過 · 2008-12-24 · via 博客园 - 愛如風過

 <script type="text/javascript" src="JS/jquery.js"></script>                    //与Prototype 类似的框架
 <script type="text/javascript" src="JS/JCookie.js"></script>                 //插件
///////////////////////////////////////////////////////
           /*JCookie.js * /
  jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        var path = options.path ? '; path=' + options.path : '';
        var domain = options.domain ? '; domain=' + options.domain : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
////////////////////////////////////////////////////////

                
 <div id="latestp"></div>
     <script type="text/javascript">
       var historyp;
       //最新访问的商品编号ID
       var nid="新商品编号ID"; 

       //设置cookie保存的浏览记录的条数
       var N=10; 
       var count=0;
       //判断是否存在cookie
       if($.cookie('smile1314h')==null) //cookie 不存在
       {
              //创建新的cookie,保存浏览记录
              $.cookie('smile1314h',nid,{expires:7,path:'/'});
              //$.cookie('smile1314h',nid,{expires:7,path:'/',domain:'smile1314.com',secure:true});
       }
       else //cookies已经存在
       {
            
            //获取浏览过的商品编号ID
             historyp=$.cookie('smile1314h');
              
           var check_result = $('#latestp'); 
           check_result.html('<img src=/CSS/Image/Loading.gif style=/"margin-left:40px;;/">');
          
            //ajax 根据产品编号获取信息列表
           $.ajax({ //一个Ajax过程   
                   type: "get",   
                   url : "/Comm/getLatestProduct.ashx",   
                   dataType:'html',  
                   data: "P_Id="+historyp,     
                   success: function(json){
                           check_result.html("");
                           check_result.html(json);
                   }});
             
             //分解字符串为数组
              var pArray=historyp.split(',');
             //最新访问的商品编号放置载最前面
              historyp=nid;
             //判断是该商品编号是否存在于最近访问的记录里面
               for(var i=0;i<pArray.length;i++)
              {
                 if(pArray[i]!=nid)
                 {
                    historyp=historyp+","+pArray[i];
                    count++;
                    if(count==N-1)
                    {
                       break;
                    }
                 }
              }
              //修改cookie的值
                 $.cookie('smile1314h',historyp);     
       }
 </script>