jQuery編輯外掛程式TinyMCE的使用方法

來源:互聯網
上載者:User

jQuery編輯外掛程式TinyMCE是一個非常容易整合到您系統的一個html編輯外掛程式,它不像FckEditor那樣需要針對專門的後台語言整合,TinyMCE既能做到輕鬆整合asp.net,php,java又能非常容易的進行擴充和二次開發。

修改簡化檔案大小後的案例下載:下載檔案到本地

免費在 http://linux.bkjia.com/

使用者名稱與密碼都是www.bkjia.com

具體下載目錄在 /2013年資料/10月/26日/jQuery編輯外掛程式TinyMCE的使用方法

下載方法見

1 html

<textarea id=”txtcontent” runat=”server” name=”elm1″ rows=”15″ cols=”80″ style=”width:80%”></textarea>

2 js引用
首先引用tiny_mce.js和jquery-1.4.2.min.js
tinyMCE的調用:

<script type=”text/javascript”>
tinyMCE.init({
// 通用參數配置
mode : “textareas”,

theme : “advanced”,

plugins :”pagebreak,style,layer,table,save”,

// 主題參數配置
theme_advanced_buttons1 :”,bold,italic,underline,strikethrough”,
theme_advanced_buttons2 : “”,
theme_advanced_toolbar_location : “top”,
theme_advanced_toolbar_align : “left”,
theme_advanced_statusbar_location : “bottom”,
theme_advanced_resizing : true,

// 在此處可以更換您自己的樣式
content_css : “css/word.css”,

external_link_list_url : “lists/link_list.js”,

// Replace values for the template plugin
template_replace_values : {
username : “Some User”,
staffid : “991234″
}
});
</script>

參數詳解:
mode:textareas或者exact
elements:配合mode中exact使用,它的值為html中要使用的textaear的id或name名稱
theme:所使用的樣式
skin:找到相應的skin目錄下樣式
skin_variant:skin目錄下的檔案css選擇,如:skin_variant : “black”表示:skins\o2k7\ui_black.css
plugins:plugins檔案夾下外掛程式的選擇使用
theme_advanced_buttons1:第一行的功能按鈕顯示,一下以此類推theme_advanced_buttons2等等

3 擴充
向輸入框中通過js追加一個圖片並顯示,js代碼如下:

tinyMCE.execCommand(‘mceInsertContent’,false,”<p><img src=\”../images/house.jpg\” alt=\”\” width=\”588\” height=\”419\” /></p>”);

通過js擷取輸入框內容,代碼如下:
tinyMCE.getInstanceById(‘txtcontent’).getBody().innerHTML

TinyMCE 的詳細介紹:請點這裡
TinyMCE 的:請點這裡

推薦閱讀:

安裝jira4.1.2forLinux並hack富文字編輯器TinyMCE

TinyMCE使用配置詳解

TinyMCE使用手冊

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.