dynamic-load.html 944 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Dynamic Load Examples</title>
  6. <style>
  7. form {
  8. margin: 0;
  9. }
  10. textarea {
  11. display: block;
  12. }
  13. </style>
  14. <script charset="utf-8" src="jquery.js"></script>
  15. <script>
  16. $(function() {
  17. $('input[name=load]').click(function() {
  18. $.getScript('../kindeditor-min.js', function() {
  19. KindEditor.basePath = '../';
  20. KindEditor.create('textarea[name="content"]');
  21. });
  22. });
  23. $('input[name=remove]').click(function() {
  24. KindEditor.remove('textarea[name="content"]');
  25. });
  26. });
  27. </script>
  28. </head>
  29. <body>
  30. <h3>异步加载</h3>
  31. <form>
  32. <textarea name="content" style="width:800px;height:200px;"></textarea>
  33. <p>
  34. <input type="button" name="load" value="加载JS并创建编辑器" />
  35. <input type="button" name="remove" value="删除编辑器" />
  36. </p>
  37. </form>
  38. </body>
  39. </html>