国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

文本編輯器 CKEditor 用法

2019-11-17 01:58:50
字體:
來源:轉載
供稿:網友

文本編輯器 CKEditor 用法

最新文本編輯器,FCK升級版:CKEditor.NET

CKEditor.NET.dll 版本:3.6.4.0

官方網址:http://ckeditor.com/

 

效果圖:

image

 

 

配置web.config:

<system.web>     <pages>         <controls>              <add tagPRefix="CKEditor" assembly="CKEditor.NET" namespace="CKEditor.NET"/>         </controls>      </pages>

<system.web>

 

頁面上加入標簽:

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>

 

aspx頁面插入控件:

<CKEditor:CKEditorControl ID="txtRemark" runat="server"  BasePath="~/UserControl/ckeditor/"  Toolbar="Source|Preview|Templates|Cut|Copy|Paste|Undo|Redo|Bold|Italic|Underline|Font|FontSize|TextColor|BGColor|Maximize" Width="388px" Height="150px" >

 

工具欄設置,如在js中加載了此控件,那設置的工具欄則無效,需在js中重新設置工具欄:

3種方式設置:

     1、在頁面中設置:設置Toolbar屬性 以"|"分隔每個菜單,"-"添加一個分割符,"/"添加一個換行

Toolbar="Source|Preview|Templates|Cut|Copy|Paste|Undo|Redo|Bold|Italic|Underline|Font|FontSize|TextColor|BGColor|Maximize"

   

    2、cs代碼:在代碼中加入(默認全部工具欄顯示)

"-" 分隔符,"/" 換行符,新的new object[] 為一個分組

txtRemark.config.toolbar = new object[]

{

       new object[] { "Source", "-", "Preview", "-", "Templates" },

       new object[] { "Cut", "Copy", "Paste", "PasteText", "PasteFromWord", "-", "Print", "SpellChecker", "Scayt" },

       new object[] { "Undo", "Redo", "-", "Find", "Replace", "-", "SelectAll", "RemoveFormat" },

       new object[] { "Form", "Checkbox", "Radio", "TextField", "Textarea", "Select", "Button", "ImageButton", "HiddenField" },

       "/",

       new object[] { "Bold", "Italic", "Underline", "-", "Subscript", "Superscript" },

       new object[] { "NumberedList", "BulletedList", "-", "Outdent", "Indent"},

       new object[] { "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock" },

       new object[] { "Link", "Unlink", "Anchor" },

       new object[] { "Image", "Flash", "Table", "HorizontalRule", "Smiley", "SpecialChar", "PageBreak", "Iframe" },

       "/",

       new object[] { "Styles", "Format", "Font", "FontSize" },

       new object[] { "TextColor", "BGColor" },

       new object[] { "Maximize" }

}

   3、JS中設置:調用加載編輯器控件 (若使用此方法,在頁面或代碼中設置的工具欄則無效,如不需js調用控件可采用第1種方法)

$(

   function ()

   {

               CKEDITOR.replace('txtRemark', {                     toolbar : //重設工具欄                               [

                                  ['Source', 'Preview',],                                   ['Bold', 'Italic', 'Underline'],                                   ['Outdent', 'Indent'],                                   ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],                                   ['Link', 'Unlink'],                                   '/',                                   ['Font', 'FontSize'],                                   ['TextColor', 'BGColor','-','Maximize']                               ]                 }); //編輯器

    } );

 

js取值和賦值:

賦值:CKEDITOR.instances.txtRemark.setData("值");

取值:var obj = CKEDITOR.instances.txtRemark.getData();

 

 

cs代碼中獲取值:

txtRemark.Text


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 商南县| 四平市| 榕江县| 吴川市| 蒙城县| 广昌县| 乌拉特后旗| 福州市| 普安县| 大田县| 金华市| 西平县| 普兰县| 河南省| 吉水县| 闸北区| 赣榆县| 策勒县| 望谟县| 伊通| 龙川县| 枣阳市| 滁州市| 吴旗县| 新乡县| 古田县| 弥渡县| 石嘴山市| 融水| 吉林省| 海宁市| 西华县| 太仆寺旗| 黄浦区| 湟源县| 中山市| 滦南县| 滨海县| 霍山县| 松原市| 天长市|