<link rel="stylesheet" href="/kindeditor-4.0.6/themes/default/default.css" /> <link rel="stylesheet" href="/kindeditor-4.0.6/plugins/code/prettify.css" />
<script charset="utf-8" src="/kindeditor-4.0.6/kindeditor.js"></script> <script charset="utf-8" src="/kindeditor-4.0.6/lang/zh_CN.js"></script> <script charset="utf-8" src="/kindeditor-4.0.6/plugins/code/prettify.js"></script> <script> KindEditor.ready(function(K) { var editor1=K.create('textarea[name="description"]',{//name=form中textarea的name屬性 cssPath : '/kindeditor-4.0.6/plugins/code/prettify.css', uploadJson : '/kindeditor-4.0.6/php/upload_json.php', fileManagerJson : '/kindeditor-4.0.6/php/file_manager_json.php', allowFileManager : true, afterCreate : function() { var self = this; K.ctrl(document, 13, function() { self.sync(); K('form[name=myform]')[0].submit(); // name=form表單的name屬性 }); K.ctrl(self.edit.doc, 13, function() { self.sync(); K('form[name=myform]')[0].submit(); // name=form表單的name屬性 }); } }); prettyPrint(); }); </script>
<form name="myform" method="post" action="根據實際填寫"> <textarea name="description" style="width:700px;height:200px;"> </textarea> <br /> <input type="submit" name="button" value="提交內容" /> (提交快捷鍵: Ctrl + Enter) </form>最後在action中使用$_REQUEST['description']便可獲取到在文本編輯器中輸入的內容。
3.效果圖
php
在線例子
http://weizongwei.sinaapp.com/application/views/kindeditor1.php css