html5 localStorage儲存

2022-01-11 11:02:40 字數 757 閱讀 8527

例項:重新整理值會增長,關掉瀏覽器,再開啟,值會在原基礎上增長

if

(localstorage.pagecount)

else

document.write(localstorage.pagecount);

設定和取值兩種方法:

1、操作dot

設值 

localstorage.hello = 'world';

localstorage.zhangsan = 'lisi';

取值:var value_of_hello_in_localstorage =localstorage.hello;

var value_of_zhangsan_in_localstorage = localstorage.zhangsan

2、get setitem

設值:

localstorage.setitem("hello", "world");

localstorage.setitem("zhangsan", "lisi");

取值:localstorage.getitem("hello");

localstorage.getitem("zhangsan");

//ie6~7 使用cookie ,其他瀏覽器html5使用localstorage

if

(window.localstorage)

else

HTML5商城開發一 樓層滾動載入資料

對於樓層載入在以前只是個想法,從來沒實現過,剛好專案中碰到,再此總結一下 場景 html5,區域性商品列表資訊滾動 區域性滾動條 1 通過j...