主题: 一个页面怎么同时存在两个编辑器啊 |
作者: 微笑, 发布日期: 2012-11-01 17:05:07, 浏览数: 2611 |
KindEditor.ready(function(K) {
var editor1 = K.create('textarea[name="contentx"]',{ cssPath : '../lgw_kindeditor/plugins/code/prettify.css', uploadJson : '../lgw_kindeditor/upload_json.asp', fileManagerJson : '../lgw_kindeditor/file_manager_json.asp', allowFileManager : true, afterCreate : function() { var self = this; K.ctrl(document, 13, function() { self.sync(); K('form[name=info_ck_from]')[0].submit(); }); K.ctrl(self.edit.doc, 13, function() { self.sync(); K('form[name=info_ck_from]')[0].submit(); }); } }); prettyPrint(); var editor2 = K.create('textarea[name="contentx2"]',{ cssPath : '../lgw_kindeditor/plugins/code/prettify.css', uploadJson : '../lgw_kindeditor/upload_json.asp', fileManagerJson : '../lgw_kindeditor/file_manager_json.asp', allowFileManager : true, afterCreate : function() { var self = this; K.ctrl(document, 13, function() { self.sync(); K('form[name=info_ck_from]')[0].submit(); }); K.ctrl(self.edit.doc, 13, function() { self.sync(); K('form[name=info_ck_from]')[0].submit(); }); } }); prettyPrint(); });
我这样写是没用 指点下 谢谢啊 |
作者: 小浪子, 发布日期: 2012-11-01 17:06:26 |
建议你写成函数,调用方便。想调用多少个都行
|
回复 |
作者: 小浪子, 发布日期: 2012-11-01 18:30:55 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test Examples</title> <script charset="utf-8" src="../kindeditor-min.js"></script> <script charset="utf-8" src="../lang/zh_CN.js"></script> <script> KindEditor.ready(function(K) { LoadEditor('message1', 'example'); LoadEditor('message2', 'example'); LoadEditor('message3', 'example'); }); function LoadEditor(TextName, FormName) { var editor1 = KindEditor.create('textarea[name="' + TextName + '"]', { uploadJson: '../lgw_kindeditor/upload_json.asp', fileManagerJson: '../lgw_kindeditor/file_manager_json.asp', allowFileManager: true, afterCreate: function() { var self = this; KindEditor.ctrl(document, 13, function() { self.sync(); KindEditor('form[name=' + FormName + ']')[0].submit(); }); KindEditor.ctrl(self.edit.doc, 13, function() { self.sync(); KindEditor('form[name=' + FormName + ']')[0].submit(); }); } }); return editor1; } </script> </head> <body> <form name="example"> <textarea name="message1" style="width:800px;height:400px;visibility:hidden;"></textarea> <textarea name="message2" style="width:800px;height:400px;visibility:hidden;"></textarea> <textarea name="message3" style="width:800px;height:400px;visibility:hidden;"></textarea> </form> </body> </html> |
回复 |