html5本地存储(仅仅记录自己已经用到的知识)

   存储数据:

            window.localStorage.setItem('key', score1);
            window.localStorage.setItem('key1', zhi1);
            window.localStorage.setItem('key2', zhi2);
            window.localStorage.setItem('key3', zhi3);

 

          获取数据:

         var score1 = localStorage.getItem(localStorage.key(0));
         var zhi1 = localStorage.getItem(localStorage.key(1));
         var zhi2 = localStorage.getItem(localStorage.key(2));
         var zhi3 = localStorage.getItem(localStorage.key(3));

 

   

posted @ 2018-06-14 07:49  独行的心  阅读(112)  评论(0编辑  收藏  举报