需要创建一个简单的 html 待办事项列表,以便它可以编辑事件。事件将存储在本地存储中。到目前为止,我有以下内容。无法保存问题 (saving0)。一般来说,能找到现成的解决方案就好了,但是我还没有找到。万事俱备!!!
<textarea rows="5" cols="30" id="T1"></textarea>
<input type="button" value="save" onclick=saving0()/><input>
<script>
var Key1 = "Areg";
var Key2 = 1234567;
var Key3 = "Arthur";
//localStorage["1"] = Key1;
//localStorage["2"] = Key2;
//localStorage["3"] = Key3;
var U = localStorage["1"];
function saving0() {
localStorage["1"] = (getText0());
}
function getText0() {
str1 = document.getElementById('T1');
return (str1.value + "");
}
function setText0(value) {
document.getElementById('T1').value = value;
}
</script>
<script>
setText0(localstorage["1"]);
//setText0(getText0());
</script>
2 个回答