在HTML5 localStorage中保存并返回历史记录2次

时间:2018-06-19 03:06:20

标签: html5 button local-storage

现在我有两个值:

var Content1 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. ";
var Content2 = "ABCXYZ";

然后我设定值:

按按钮1设置Content1

localStorage.setItem("Content1", Content1);

按按钮2设置Content2

localStorage.setItem("Content2", Content2);

当我按回浏览器时,如何获得值1和2?

localStorage.getItem("tContent1 or Content2");

0 个答案:

没有答案