<asp:TextBox runat="server" ID="txtRemarks" TextMode="MultiLine"></asp:TextBox> <span id="sp_limtNum"></span>(200字以内)
<link rel="stylesheet" href="/kindeditor/themes/default/default.css" /> <link rel="stylesheet" href="/kindeditor/plugins/code/prettify.css" /> <script charset="utf-8" src="/kindeditor/kindeditor-all.js"></script> <script charset="utf-8" src="/kindeditor/plugins/code/prettify.js"></script> <script> KindEditor.ready(function (K) { var editor = K.create('#<%=txtRemarks.ClientID%>', { items: [ 'source', '|', 'undo', 'redo', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', '|', 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough', '|', 'insertfile', 'table', '|', 'fullscreen' ], langType: "<%=Maticsoft.Web.Components.LanguageHelper.CultureLanguage %>", uploadJson: '/kindeditor/asp.net/upload_json.ashx', fileManagerJson: '/kindeditor/asp.net/file_manager_json.ashx', allowFileManager: true, afterCreate: function () { }, afterChange: function () { //$('.word_count2').html(this.count('text')); //字数统计包含纯文本、IMG、EMBED,不包含换行符,IMG和EMBED算一个文字 //限制字数 var limitNum = 200; //设定限制字数 var pattern = '还可以输入' + limitNum + '字'; $('#sp_limtNum').html(pattern); //输入显示 if (this.count('text') > limitNum) { pattern = ('字数超过限制,请适当删除部分内容'); //超过字数限制自动截取 var strValue = editor.text(); strValue = strValue.substring(0, limitNum); editor.text(strValue); } else { //计算剩余字数 var result = limitNum - this.count('text'); pattern = '还可以输入' + result + '字'; } $('#sp_limtNum').html(pattern); //输入显示 }, //afterBlur: function () { // //编辑器失去焦点时直接同步,可以取到值 // this.sync(); //解决parsley.js验证失效的问题 //} }); prettyPrint(); }); </script>