开发者

local storage in IE

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜