newline.html 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Newline Examples</title>
  6. <style>
  7. form {
  8. margin: 0;
  9. }
  10. textarea {
  11. display: block;
  12. }
  13. </style>
  14. <link rel="stylesheet" href="../themes/default/default.css" />
  15. <script charset="utf-8" src="../kindeditor-min.js"></script>
  16. <script charset="utf-8" src="../lang/zh_CN.js"></script>
  17. <script>
  18. KindEditor.ready(function(K) {
  19. var editor;
  20. K('select[name=newlineTag]').change(function() {
  21. if (editor) {
  22. editor.remove();
  23. editor = null;
  24. }
  25. editor = K.create('textarea[name="content"]', {
  26. newlineTag : this.value
  27. });
  28. });
  29. K('select[name=newlineTag]').change();
  30. });
  31. </script>
  32. </head>
  33. <body>
  34. <h3>回车换行设置</h3>
  35. <form>
  36. <p>
  37. <select name="newlineTag">
  38. <option value="br">BR换行</option>
  39. <option value="p">P换行</option>
  40. </select>
  41. </p>
  42. <textarea name="content" style="width:800px;height:200px;"></textarea>
  43. </form>
  44. </body>
  45. </html>