博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
编辑器实时保存内容
阅读量:6989 次
发布时间:2019-06-27

本文共 2082 字,大约阅读时间需要 6 分钟。

hot3.png

var editor = $('.xheditor').xheditor({                tools:'mini'            });                        setInterval('save()',3000);            function save(){                setTimeout('saveData("info",editor[0].getSource())',3000);                setTimeout('saveData("features",editor[1].getSource())',3000);                setTimeout('saveData("other",editor[2].getSource())',3000);            }            var PwStorage = {                save : function(key, value, force) {                    if (window.ActiveXObject) {                        with(document.documentElement) try {                            load(key);                            setAttribute("value", value);                            save(key);                        } catch(e) {return false;}                    } else if (window.sessionStorage) {                        try {                            sessionStorage.setItem(key,value);                        } catch(e) {return false;}                    }                    return true;                },                load : function(key) {                    var msg = '';                    if (window.ActiveXObject) {                        with (document.documentElement) try {                            load(key);                            msg = getAttribute("value");                        } catch(e) {}                    } else if (window.sessionStorage) {                        try {                            msg = sessionStorage.getItem(key);                        } catch(e) {}                    } else {                        return false;                    }                    return msg;                },            }            function saveData(key, value){                PwStorage.save(key, value);            }            var msg1 = PwStorage.load('info');            var msg2 = PwStorage.load('features');            var msg3 = PwStorage.load('other');            editor[0].setSource(msg1);            editor[1].setSource(msg2);            editor[2].setSource(msg3);

转载于:https://my.oschina.net/u/947558/blog/277596

你可能感兴趣的文章
分析Linux内核创建一个新进程的过程【转】
查看>>
周锦民:腾讯在线教育视频互动直播间技术实践
查看>>
[转]UML类图、关系及其JAVA代码
查看>>
PhotoShop算法原理解析系列 - 像素化---》碎片。
查看>>
设计模式之责任链模式
查看>>
php多态设计
查看>>
CSS格式化 CSS代码压缩工具
查看>>
mvc伪静态<三> IIS配置
查看>>
Visual Studio中的lib的链接顺序
查看>>
android自定义radiobutton样式文字颜色随选中状态而改变
查看>>
【CodeForces 604B】F - 一般水的题1-More Cowbe
查看>>
wxPython 4.0.0b2安装
查看>>
Android RecyclerView利用Glide加载大量图片into(Target)导致OOM异常
查看>>
UGUI表情系统解决方案
查看>>
HTTP Health Checks
查看>>
为什么正态分布如此普遍
查看>>
jQuery事件
查看>>
BBS论坛(三十)
查看>>
轻松看懂Java字节码
查看>>
AE TIN的切割
查看>>