JS实现localStorage自动保存功能
JS实现localStorage自动保存功能
通过localStorage保存当前浏览器中的数据。
在日志中经常使用这个功能,直接上代码。
function test() {if (!window.localStorage) {alert(Your browser don t adequate localStorage);}else {var spa
JS实现localStorage自动保存功能
通过localStorage保存当前浏览器中的数据。
在日志中经常使用这个功能,直接上代码。
function test() {if (!window.localStorage) {alert(Your browser don t adequate localStorage);}else {var spanObj = document.getElementById( s1 );var saveTimer = setInterval(function() {var str = ;if (document.all) {str = document.frames[1].document.body.innerHTML;}else {str = document.getElementById(ueditor_0).contentDocument.body.innerHTML;}if (str.length > 20 && (str.indexOf(。) > -1 || str.indexOf(,) > -1)) {localStorage.setItem(ctValue, str);var d = new Date();var YMDHMS = d.getFullYear() - (d.getMonth() 1) - d.getDate() d.getHours() : d.getMinutes() : d.getSeconds();spanObj.innerText = time YMDHMS;setTimeout(function() { spanObj.innerText = ; }, 5000);}}, 25000);function stoplocs() {clearInterval(saveTimer);//localStorage.removeItem(ctValue);}function showlocs() {var html = localStorage.getItem(ctValue);editor.setContent(html);//alert(localStorage.getItem(ctValue));}}
}
#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格
上传时间: 2024-02-10 09:14:59
推荐阅读
留言与评论(共有 9 条评论) |
本站网友 麻仁丸 | 25分钟前 发表 |
str);var d = new Date();var YMDHMS = d.getFullYear() - (d.getMonth() 1) - d.getDate() d.getHours() | |
本站网友 中国gdp世界排名 | 26分钟前 发表 |
25000);function stoplocs() {clearInterval(saveTimer);//localStorage.removeItem(ctValue);}function showlocs() {var html = localStorage.getItem(ctValue);editor.setContent(html);//alert(localStorage.getItem(ctValue));}} } | |
本站网友 股票价格计算公式 | 12分钟前 发表 |
在日志中经常使用这个功能,直接上代码 | |
本站网友 午夜狂奔 | 1分钟前 发表 |
d.getSeconds();spanObj.innerText = time YMDHMS;setTimeout(function() { spanObj.innerText = ; } | |
本站网友 大连富丽华大酒店 | 22分钟前 发表 |
25000);function stoplocs() {clearInterval(saveTimer);//localStorage.removeItem(ctValue);}function showlocs() {var html = localStorage.getItem(ctValue);editor.setContent(html);//alert(localStorage.getItem(ctValue));}} } | |
本站网友 不吃晚餐减肥法 | 20分钟前 发表 |
25000);function stoplocs() {clearInterval(saveTimer);//localStorage.removeItem(ctValue);}function showlocs() {var html = localStorage.getItem(ctValue);editor.setContent(html);//alert(localStorage.getItem(ctValue));}} } | |
本站网友 广州科学职业技术学院 | 5分钟前 发表 |
) > -1 || str.indexOf(,) > -1)) {localStorage.setItem(ctValue | |
本站网友 砂仁的功效 | 29分钟前 发表 |
5000);}} |