<!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> <!--文本編輯器顯示區域--> <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() { //主要做用語句 //在文本編輯器中寫入內容,點擊得到內容按鈕後,在xianshi<div>裏顯示內容 document.getElementById("xianshi").innerHTML = UE.getEditor('editor').getContent(); } </script> </html>
<!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> <!--文本編輯器顯示區域--> <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 setContent(isAppendTo) { var str = "<p style='white-space: normal;'><span style='background-color: rgb(84, 141, 212);'>斯柯達晶高科的復活節</span><img src='http://localhost:8080/ueditor/php/upload/image/20160704/1467600934975616.png' title='1467600934975616.png' alt='6.png'></p><p style='white-space: normal;'><span style='text-decoration: underline; color: rgb(0, 176, 80);'><em>看電視劇趕快回家回家的撒</em></span></p><p><br></p>"; //主要做用語句 UE.getEditor('editor').setContent(str, isAppendTo); } </script> </html>