①js文件的引入
<script src="/public/ckeditor_4.4.7/ckeditor.js"></script> <script src="/public/ckfinder_2.5.0/ckfinder.js"></script>
②javascript编写
<script type="text/javascript"> function BrowseServer() { // You can use the "CKFinder" class to render CKFinder in a page: var finder = new CKFinder(); finder.basePath = ‘/public/ckfinder_2.5.0/‘; // The path for the installation of CKFinder (default = "/ckfinder/"). finder.selectActionFunction = SetFileField; finder.popup(); } function SetFileField(fileUrl) { document.getElementById(‘TxtPictureUrl‘).value = fileUrl; } $(document).ready(function () { editor = CKEDITOR.replace(‘TxtContent‘); CKFinder.setupCKEditor(editor, ‘/public/ckfinder_2.5.0/‘); $("#BtnSave").click(function () { //判断标题是否为空 if ($("#TxtTitle").val() == ‘‘) { alert(‘请输入标题.‘); $("#TxtTitle").focus(); return false; } var content = editor.getData(); //判断内容是否为空 if (content == ‘‘) { alert(‘请输入文章内容.‘); return false; } }); }); </script>
③body加入TextBox显示ckeditor
<td> <asp:TextBox ID="TxtContent" runat="server" TextMode="MultiLine"></asp:TextBox> </td>
④后台获取ckeditor的值
item.Content = TxtContent.Text;
时间: 2024-10-06 00:18:30