본문 바로가기

프로그래밍

ASP - CHEditor 3.1 사용법

출처 : http://winry.tistory.com/tag/cheditor

정말 사용하면서 감탄의 감탄을 자아내는 에디터다.... 물론 윗버전도 존재하지만..
무료버전도 정말 하나 버릴것없이 훌륭하다..
무료버전을 지금도 다운받을수 있을지는 모르겠지만.. 참고하면 좋을듯...
http://www.chcode.com/

사용법을 간단하게 기록해 본다!!
1. cheditor 폴더를 루트에....

2. cheditor 링크~~
       <script language="javascript" src="/cheditor/cheditor.js"></script>

3. 있어야 할곳에 GoGo~~~
  <script type="text/javascript">
    var myeditor = new cheditor("myeditor");
    myeditor.width =  "100%" ;
    myeditor.height = 380;
    myeditor.editorToolbar = "background-color:#f4f4f4;";
    myeditor.editorBorder  = "1px #696969 solid";
    myeditor.formName = "frm";
    myeditor.run();
  </script>

4. 값을 넘기기 위해서 hidden 값을 하나 만들고~~
  <input type="hidden" name="content" id="content">

5. submit을 보낼때 값을 hidden에 저장...
  f.content.value = myeditor.outputHTML();
  var msg_length = myeditor.ContentLength();

6. 참고로 한페이지에 2개의 에디터를 넣어줄때는...
  var myeditorSUB = new cheditor("myeditorSUB")
  ↑ 요렇게 진한글씨끼리 똑깥이 변경해주고 2곳에 이름 다르게 넣어주면 끝!!~....^^

7. 수정페이지 만들기!!
  <FORM method="post" name="frm">
  <input type="hidden" name="contents" id="contents">
  <input type="hidden" name="paste" value="<%=content%>">
  <script type="text/javascript">
    var myeditor = new cheditor("myeditor");
    myeditor.width =  "100%" ;
    myeditor.height = 380;
    myeditor.pasteContent = true;
    myeditor.pasteContentForm = "paste";
    myeditor.editorToolbar = "background-color:#f4f4f4;";
    myeditor.editorBorder  = "1px #696969 solid";
    myeditor.formName = "frm";
    myeditor.run();
  </script>
  </FORM>

진한글씨 추가... 하시고 HIDDEN 값으로 위에처럼 INPUT을 추가해주면 됩니다!!!! 

P.S : HIDDEN값에 미리 입력되어진 내용을 찍어주는데요... 쌍따옴표나 홑따옴표가 내용중에 있을때.. HIDDEN값에서 값이 닫혀져서 내용에 찍혀지는 오류가 있는데요.. 그것때문에.. 꼭 REPLACE를 시켜줘야 합니다!!
CONTENTS = REPLACE(CONTENTS, """","&quot;") 로....

'프로그래밍' 카테고리의 다른 글

MSSQL - 테이블 필드값 옮기기  (0) 2011.10.06
MSSQL - CONVERT(VARCHAR(20),GETDATE(),number)  (0) 2011.10.06
ASP - 내장함수  (0) 2011.08.17
ASP - 날짜 함수  (0) 2011.08.17
ASP - 최근본 상품  (0) 2011.08.17