void GetHtmlContents(paramObj, editor_id)
에디터의 디자인 영역에 작성된 html을 얻어옵니다.
return value
callback 함수로 html 데이터가 리턴됩니다.
parameters
paramObj 가져올 html 타입, call back 함수 등을 지정합니다.
- paramObj.type 가져올 html 타입 입니다.
htmlexwithdoctype : doctype을 포함한 html의 outerHTML을 얻습니다.
htmlex : html의 outerHTML을 얻습니다.
html : html의 innerHTML을 얻습니다.
bodyex : body의 outerHTML을 얻습니다.
body : body의 innerHTML을 얻습니다.
text : 작성된 text값만을 얻습니다.
- paramObj.isAuto 자동저장 용으로 사용하는 경우 true값을 지정합니다.
- paramObj.callback 작성된 html을 얻기위한 callback 함수를 지정합니다.
callback 함수로 넘어오는 파라미터에서 htmlData와 에디터 ID 값을 얻을 수 있습니다.
callbackParam.strEditorId : 에디터 ID
callbackParam.strData : html 데이터
editor_id html 소스를 가져올 에디터의 id를 의미합니다.
remarks
RAONKEDITOR.GetHtmlContents({type: "body", isAuto:false, callback:fn_callback}, "editor1")
"editor1" 에디터에 작성된 내용 중 body의 innerHTML 값을 얻어옵니다.
sample code
<!-- ..... 생략 ..... --> <script type="text/javascript" src="keditor/js/raonkeditor.js"></script> <script type="text/javascript"> function getHtmlContents() { // id가 editor1인 에디터 디자인 영역의 body innerHTML 소스를 경고창으로 띄웁니다. RAONKEDITOR.GetHtmlContents({ type: 'body', isAuto: false, callback: function (paramObj) { alert(paramObj.strData); } }, 'editor1'); } </script> <!-- ..... 생략 ..... --> <div style="width:900px;height:550px"> <script type="text/javascript"> new RAONKEditor({Id:'editor1'}); </script> </div> <!-- ..... 생략 ..... --> </body> </html>