JSP頁面中嵌入UEditor編輯器方法

<link rel="stylesheet" href="UEditor/themes/default/css/ueditor.css">javascript

<script type="text/javascript" charset="utf-8" src="<%=path%>/ueditor/ueditor.config.js"></script>css

<script type="text/javascript" charset="utf-8" src="<%=path%>/ueditor/ueditor.all.js"> </script>html

       <!--建議手動加在語言,避免在ie下有時由於加載語言失敗致使編輯器加載失敗-->java

       <!--這裏加載的語言文件會覆蓋你在配置項目裏添加的語言類型,好比你在配置項目裏配置的是英文,這裏加載的中文,那最後就是中文-->閉包

<script type="text/javascript" charset="utf-8" src="<%=path%>/ueditor/lang/zh-cn/zh-cn.js"></script>編輯器

<div class="controls"><textarea rows="5" cols="100" style="width: 50%;display: none;" id="txaContent" name="training.content">${meetingWork.content}</textarea>htm

<script id="scrContent" type="text/plain" style="width:100%;height:355px;">${meetingWork.content}ip

                                                                            </script></div>utf-8

 

<script type="text/javascript">get

//實例化編輯器//建議使用工廠方法getEditor建立和引用編輯器實例,若是在某個閉包下引用該編輯器,直接調用UE.getEditor('editor')就能拿到相關的實例

                     var ue = UE.getEditor('scrContent');

                     function insertHtml() {

                            var value = prompt('插入html代碼', '');

                            UE.getEditor('editor').execCommand('insertHtml', value)

                     }

                     function createEditor() {

                            enableBtn();

                            UE.getEditor('editor');

                    }</script>

相關文章
相關標籤/搜索