default.html 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Default 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. var editor;
  19. KindEditor.ready(function(K) {
  20. editor = K.create('textarea[name="content"]', {
  21. allowFileManager : true
  22. });
  23. K('input[name=getHtml]').click(function(e) {
  24. alert(editor.html());
  25. });
  26. K('input[name=isEmpty]').click(function(e) {
  27. alert(editor.isEmpty());
  28. });
  29. K('input[name=getText]').click(function(e) {
  30. alert(editor.text());
  31. });
  32. K('input[name=selectedHtml]').click(function(e) {
  33. alert(editor.selectedHtml());
  34. });
  35. K('input[name=setHtml]').click(function(e) {
  36. editor.html('<h3>Hello KindEditor</h3>');
  37. });
  38. K('input[name=setText]').click(function(e) {
  39. editor.text('<h3>Hello KindEditor</h3>');
  40. });
  41. K('input[name=insertHtml]').click(function(e) {
  42. editor.insertHtml('<strong>插入HTML</strong>');
  43. });
  44. K('input[name=appendHtml]').click(function(e) {
  45. editor.appendHtml('<strong>添加HTML</strong>');
  46. });
  47. K('input[name=clear]').click(function(e) {
  48. editor.html('');
  49. });
  50. });
  51. </script>
  52. </head>
  53. <body>
  54. <h3>默认模式</h3>
  55. <form>
  56. <textarea name="content" style="width:800px;height:400px;visibility:hidden;">KindEditor</textarea>
  57. <p>
  58. <input type="button" name="getHtml" value="取得HTML" />
  59. <input type="button" name="isEmpty" value="判断是否为空" />
  60. <input type="button" name="getText" value="取得文本(包含img,embed)" />
  61. <input type="button" name="selectedHtml" value="取得选中HTML" />
  62. <br />
  63. <br />
  64. <input type="button" name="setHtml" value="设置HTML" />
  65. <input type="button" name="setText" value="设置文本" />
  66. <input type="button" name="insertHtml" value="插入HTML" />
  67. <input type="button" name="appendHtml" value="添加HTML" />
  68. <input type="button" name="clear" value="清空内容" />
  69. <input type="reset" name="reset" value="Reset" />
  70. </p>
  71. </form>
  72. </body>
  73. </html>