function saveNote() { var cOntent= document.getElementById('noteContent').value; if (content.trim()) { var timestamp = new Date().toISOString(); localStorage.setItem(timestamp, content); loadNotes(); } else { alert('请输入笔记内容!'); } }
function loadNotes() { var notesDiv = document.getElementById('notesList'); notesDiv.innerHTML = ''; for (var i = 0; i var key = localStorage.key(i); if (new Date(key) instanceof Date && !isNaN(new Date(key))) { var note = localStorage.getItem(key); notesDiv.innerHTML += '
' + key + ': ' + note + '
'; } } }
function clearNotes() { localStorage.clear(); document.getElementById('notesList').innerHTML = ''; alert('所有笔记已清除。'); }