readonly.html 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Readonly 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 = K.create('textarea[name="content"]', {
  20. readonlyMode : true
  21. });
  22. // 设置成只读状态
  23. K('input[name=readonly]').click(function() {
  24. editor.readonly();
  25. });
  26. // 取消只读状态
  27. K('input[name=cancel]').click(function() {
  28. editor.readonly(false);
  29. });
  30. });
  31. </script>
  32. </head>
  33. <body>
  34. <h3>只读模式</h3>
  35. <form>
  36. <textarea name="content" style="width:800px;height:200px;"></textarea>
  37. <p>
  38. <input type="button" name="readonly" value="设置成只读状态" />
  39. <input type="button" name="cancel" value="取消只读状态" />
  40. </p>
  41. </form>
  42. </body>
  43. </html>