zoukankan      html  css  js  c++  java
  • localStorage中js数组的存储和读取

       var old_destid = localStorage.getItem('destid');
            if (!old_destid) {
                var destids = [];
                destids.push(destid)
            } else {
                var destids = old_destid.split(',');
                if ($.inArray('<?= $destid ?>', destids) == '-1') {
                    destids.push(destid)
                }
            }
            localStorage.setItem('destid', destids.join(','));//保存数据

      var old_destid = localStorage.getItem('destid');
                    if (old_destid) {
                        var destids = old_destid.split(',');
                        var dest_stu = $.inArray('' + dest.destid + '', destids) >= 0 ? 'yicanguan' : 'weicanguan';
                    }

  • 相关阅读:
    jQuery的选择器
    01-jQuery的介绍
    client、offset、scroll系列
    BOM
    定时器
    js中的面向对象
    javascript小练手
    DOM介绍
    关于DOM的事件操作
    伪数组 arguments
  • 原文地址:https://www.cnblogs.com/YTzZ/p/4538659.html
Copyright © 2011-2022 走看看