2011年5月7日 星期六

[ Asp.Net ] CKEditor HTML編輯器

下載位置
http://ckeditor.com/download

傻瓜都會用的步驟說明。
http://docs.cksource.com/CKEditor_3.x/Developers_Guide/ASP.NET/Integration_Beginners
Absolute Beginner's CKEditor for ASP.NET Control Integration Guide

ckeditor的內容讀、寫與插入
引用網址:http://note.tcc.edu.tw/604.html

要操作 ckeditor 的內容,使用 instance 的方法,若textarea 的id="desc"。
讀取內容
var ct= CKEDITOR.instances.desc.getData();

寫入內容
CKEDITOR.instances.desc.setData( "Insert value" ) ;

這裡寫入的內容會注入到原始碼,所有帶有HTML的tags可以生效

取得焦點
CKEDITOR.instances.desc.focus();

插入內容
CKEDITOR.instances.desc.insertHtml( "insert value" ) ;

執行命令
var ct= CKEDITOR.instances.desc;
ct..execCommand('bold');
ct.execCommand('forecolor',false,'#00ff00');
ct.execCommand('JustifyCenter', false, null);
ct.execCommand('fontsize', false, 15);
  
參考資料

CKEditor 官網 http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html
CKEditor捉取、設定內容 http://www.dotblogs.com.tw/bowwowxx/archive/2010/04/01/14349.aspx 這裡有js的striptags 方法
CKEditor API-Ticket http://dev.ckeditor.com/attachment/ticket/4254/api.html
CKEditor 的插件開發 http://bbish.net/01toturial/44/ckeditor-



微軟的ASP.NET AJAX Control tooklit HTML Editor
http://studyhost.blogspot.com/2010/07/aspnet-ajaxhtml.html

沒有留言:

張貼留言

追蹤者