DEXT5 Editor :: setInsertHTML

void setInsertHTML(html, editor_id)

에디터 디자인 영역에서 커서가 있는 위치에 html 소스를 삽입합니다.

return value

없음.

parameters

html  에디터 디자인 영역에 삽입할 html 소스입니다.
editor_id  html 소스를 입력할 에디터의 id를 의미합니다.

remarks

에디터를 1개만 생성했을 경우 editor_id를 입력하지 않아도 html 소스를 삽입할 수 있습니다.
예) id가 editor1인 에디터를 생성했을 경우
     DEXT5.setInsertHTML(html, 'editor1'), DEXT5.setInsertHTML(html)
     모두 editor1 에디터 디자인 영역에서 커서가 있는 위치에 html 소스를 삽입합니다.

에디터를 2개 이상 생성했을 경우 editor_id를 반드시 입력해야 합니다.
예) id가 editor1, editor2인 에디터를 생성했을 경우
     DEXT5.setInsertHTML(html, 'editor1')  editor1 에디터 디자인 영역에서 커서위치에 html 소스를 삽입합니다.
     DEXT5.setInsertHTML(html, 'editor2')  editor2 에디터 디자인 영역에서 커서위치에 html 소스를 삽입합니다.

sample code

<!-- ..... 생략 ..... -->

<script type="text/javascript" src="dext5/js/dext5editor.js"></script>	
<script type="text/javascript">

    function insertHTML() {
        var html = '<p>Insert HTML Code</p>';

        // id가 editor1인 에디터 디자인 영역에서 커서가 있는 위치에 html 소스를 삽입합니다.
        DEXT5.setInsertHTML(html, 'editor1'); //p태그를 삽입합니다.
    }

</script>

<!-- ..... 생략 ..... -->
 
<div style="width:900px;height:550px">
  
    <!-- 에디터 생성 -->
    <script type="text/javascript">
        new Dext5editor('editor1');
    </script>       

</div>

<!-- ..... 생략 ..... -->

</body>
</html>