如下是html代碼部分:javascript
新建與ueditor同級的文件testueditor.php:進行本身的操做php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>無標題文檔</title> <script type="text/javascript" charset="utf-8" src="ueditor/utf8-php/ueditor.config.js"></script> <script type="text/javascript" charset="utf-8" src="ueditor/utf8-php/ueditor.all.min.js"> </script> <!--建議手動加在語言,避免在ie下有時由於加載語言失敗致使編輯器加載失敗--> <!--這裏加載的語言文件會覆蓋你在配置項目裏添加的語言類型,好比你在配置項目裏配置的是英文,這裏加載的中文,那最後就是中文--> <script type="text/javascript" charset="utf-8" src="ueditor/utf8-php/lang/zh-cn/zh-cn.js"></script> </head> <body> <div> <h1>完整demo</h1> <script id="editor" type="text/plain" style="width:800px;height:300px;"></script> </div> <div> <button onclick="getContent()">得到內容</button> <button onclick="setContent()">寫入內容</button> </div> <div id="xianshi"></div> </body> <script type="text/javascript"> var ue = UE.getEditor('editor'); function getContent() { document.getElementById("xianshi").innerHTML = UE.getEditor('editor').getContent(); } function setContent(isAppendTo) { var str = "<p>我看看是否是能行的,就是這麼好會說話</p><p><img src='/ueditor/php/upload/image/20160625/1466820882121569.png' title='1466820882121569.png' alt='logo.png'></p>"; UE.getEditor('editor').setContent(str, isAppendTo); } </script> </html>