HTML
HTML5 Web 存储
代码中的字符串值转换为数字类型
源代码:
点击运行 »
if (localStorage.clickcount) { localStorage.clickcount = Number(localStorage.clickcount) + 1; } else { localStorage.clickcount = 1; } document.getElementById("result").innerHTML = " 你已经点击了按钮 " + localStorage.clickcount + " 次 ";
运行结果:
点击运行 »