HTML代码:
- 修改我吧,然后刷新页面看看,^_^
JS代码:
var edit = document.getElementById("edit"); edit.onblur = function(){ localStorage.setItem("tododata", this.innerHTML); }; if(localStorage.getItem("tododata")){ edit.innerHTML = localStorage.getItem("tododata"); }
本文共 318 字,大约阅读时间需要 1 分钟。
var edit = document.getElementById("edit"); edit.onblur = function(){ localStorage.setItem("tododata", this.innerHTML); }; if(localStorage.getItem("tododata")){ edit.innerHTML = localStorage.getItem("tododata"); }
转载于:https://www.cnblogs.com/dingyuanxin/p/3918081.html