NatChen

Once you have chosen the road of life, you have to be brave enough to go to the end and never look back.

Local Storage

HTML代码:
<ul id="edit" contenteditable="true">     
  <li>修改我吧,然后刷新页面看看,^_^</li> 
</ul>
JS代码:
var edit = document.getElementById("edit"); 
    edit.onblur = function(){     
          localStorage.setItem("tododata", this.innerHTML); 
  }; 
if(localStorage.getItem("tododata")){    
    edit.innerHTML = localStorage.getItem("tododata");	
 }
posted @   NatChen  阅读(153)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示