开发者

local storage in IE

开发者 https://www.devze.com 2023-02-24 08:10 出处:网络
When I tried to get item from the local storage value , it returns \"undefined\" in IE8 I\'m using the following codes for :

When I tried to get item from the local storage value , it returns "undefined" in IE8

I'm using the following codes for :

Set item :

var value = document.getElementById('test').value;
var key = "i" + x + "test" + y;              
localStorage[key] = value;

And get Item:

var test   = localStorage["i" + x + "test" + y];
alert(test);

It return undefined

I followed the same code for firefox开发者_开发技巧 4 and chrome .. it returns the same value which i have set in the local storage


Ensure you are using the proper HTML5 Doctype:

<!DOCTYPE html>

and that you are in IE8 mode (ensure you haven't enabled some compatibility IE7 mode).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号