.biji{
margin: 10px 7px;
border: 1px solid #ccc;
border-radius: 10px;
padding: 5px;
background-color: #F7F6F2;
position: relative;
}
.shanChu{
position: absolute;
right: 3px;
top: 3px;
font-size: 12px;
}
.fixeD{
position: fixed;
width: 98%;
z-index: 1;
top: 0;
right: 0;
background-color: white;
}
#bijiList{
padding-top: 120px;
}
.line1{
display: block;
height: 1px;
background-color: #333;
margin-right: 10px;
}
备忘录
+
返回 新增备忘录
var bijis = []
loadDate();
function loadDate(){
if(localStorage.bijis){
bijis = JSON.parse(localStorage.bijis)
}
bijiList.innerHTML =""
for(var i=bijis.length-1;i>=0;i--){
var b = bijis[i];
var newDiv = document.createElement("div")
newDiv.className = "biji"
var deleteSpan = document.createElement("span")
deleteSpan.innerHTML = "删除";
deleteSpan.className = "shanChu"
var titleDiv = document.createElement("div");
titleDiv.className = "title"
titleDiv.innerHTML = b.content;
var createDateDiv = document.createElement("div")
createDateDiv.className = "createDate"
createDateDiv.innerHTML = b.createDate;
newDiv.appendChild(deleteSpan)
newDiv.appendChild(titleDiv)
newDiv.appendChild(createDateDiv)
bijiList.appendChild(newDiv)
}
}
addbtn.onclick = function () {
d1.style.display = "none"
d2.style.display = "block"
cntDiv.focus()//获得光标
}
returnbtn.onclick = function () {
d1.style.display = "block"
d2.style.display = "none"
if(cntDiv.innerHTML.length>0){
var biji = {
content:cntDiv.innerHTML,
createDate:(new Date()).toLocaleString()
}
bijis.push(biji)
localStorage.bijis = JSON.stringify(bijis);
cntDiv.innerHTML = "";
loadDate()
}
}
一键复制
编辑
Web IDE
原始数据
按行查看
历史