码迷,mamicode.com
首页 > Web开发 > 详细

.net中ckeditor的应用

时间:2015-05-29 00:47:19      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:

①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;

.net中ckeditor的应用

标签:

原文地址:http://www.cnblogs.com/linhuide/p/4537255.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!