d833830292cd7ddc39e75e4719e131c6b5985c71.svn-base 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>CHEditor Demo</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <!-- cheidtor.js 파일의 위치를 지정합니다. -->
  7. <script type="text/javascript" src="../cheditor.js"></script>
  8. </head>
  9. <body>
  10. <h2 style="text-align: center">CHEditor Demo</h2>
  11. <script type="text/javascript">
  12. function doSubmit (theform)
  13. {
  14. // ---------------------------------------------------------------------------------
  15. // myeditor라는 이름은 현재 데모에서 만들어진 에디터 개체 이름입니다.
  16. //
  17. // myeditor.outputBodyHTML() 메서드를 호출하면 에디터에서 작성한 글 내용이
  18. // myeditor.inputForm 설정 옵션에 지정한 'fm_post' 폼 값에 자동으로 입력됩니다.
  19. //
  20. // outputBodyHTML: BODY 태그 안쪽 내용을 가져옵니다.
  21. // outputBodyText: BODY 태그 안쪽의 HTML 태그를 제외한 텍스트만을 가져옵니다.
  22. // inputLength: 입력한 텍스트 문자 수를 리턴합니다.
  23. // contentsLength: BODY 태그 안쪽의 HTML 태그를 포함한 모든 문자 수를 리턴합니다.
  24. // contentsLengthAll: HTML 문서의 모든 문자 수를 리턴합니다.
  25. // 두 번째 에디터의 내용은 myeditor2.outerBodyHTML()
  26. alert(myeditor.outputBodyHTML());
  27. return false;
  28. }
  29. </script>
  30. <div style="width:80%; margin: 0 auto">
  31. <form method="post" name="theform" onsubmit="return doSubmit(this)">
  32. <textarea id="fm_post" name="fm_write"></textarea>
  33. <!-- 첫 번째 에디터를 화면에 출력합니다. -->
  34. <script type="text/javascript">
  35. var myeditor = new cheditor(); // 에디터 개체를 생성합니다.
  36. myeditor.config.editorHeight = '200px'; // 에디터 세로폭입니다.
  37. myeditor.config.editorWidth = '100%'; // 에디터 가로폭입니다.
  38. myeditor.inputForm = 'fm_post'; // 위에 있는 textarea의 id입니다. 주의: name 속성 이름이 아닙니다.
  39. myeditor.run(); // 에디터를 실행합니다.
  40. </script>
  41. <div style="margin: 10px 0">&nbsp;</div>
  42. <textarea id="fm_post2" name="fm_write2"></textarea>
  43. <!-- 두 번째 에디터를 화면에 출력합니다. -->
  44. <script type="text/javascript">
  45. var myeditor2 = new cheditor();
  46. myeditor2.config.editorHeight = '200px';
  47. myeditor2.config.editorWidth = '100%';
  48. myeditor2.inputForm = 'fm_post2';
  49. myeditor2.run();
  50. </script>
  51. <div style="text-align: center; margin-top: 20px">
  52. <input type="submit" value="글 가져오기" />
  53. </div>
  54. </form>
  55. </div>
  56. <p style="text-align: center">
  57. <span style="font-family: verdana; font-size: 12px; color: #666">
  58. Copyright ⓒ 1997-2019 by <b>CHCODE.</b> All right reserved.
  59. </span>
  60. </p>
  61. </body>
  62. </html>