首先在jsp页面引入kindeditor.js
在js中调用
KE.show({
id : 'content', resizeMode : 1, allowPreviewEmoticons : false, allowUpload : false, items : [ 'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline', 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', 'insertunorderedlist', '|', 'emoticons', 'image', 'link'], afterChange : function(id) {//内容改变时的回调 //KE.$('word_count1').innerHTML = KE.count(id); KE.$('word_count2').innerHTML = KE.count(id, 'text');//统计内容字数 } }); <textarea id="content" name="content"
style="width: 500px; height: 200px; visibility: hidden;"></textarea> <br /> 你最多能输入200个字符, <!-- 您当前输入了 <span id="word_count1">0</span> 个文字。(字数统计包含HTML代码。)--> 当前输入了 <span id="word_count2">0</span> 个文字。(字数统计包含纯文本、IMG、EMBED,不包含换行符,IMG和EMBED算一个文字。) 遇到的问题:
在java中用request.getParameter("content")时获取不到内容,在调用java保存方法前调用一下js,
KE.sync('content');//把内容赋值给textarea
|
|