You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.4 KiB

5 days ago
  1. <html>
  2. <head>
  3. <title>Demo 3 : Add/Remove NicEditors</title>
  4. </head>
  5. <body>
  6. <div id="menu"></div>
  7. <div id="intro">
  8. <p>The demo below shows toggling the display of NicEditors on both textarea and div elements. NicEdit instances can be added and removed at any time</p>
  9. </div>
  10. <br />
  11. <div id="sample">
  12. <h4>Div Example</h4>
  13. <div id="myArea1" style="width: 300px; height: 100px; border: 1px solid #000;">
  14. This is some TEST CONTENT<br />
  15. In a DIV Tag<br />
  16. Click the Buttons to activate
  17. </div>
  18. <button onClick="toggleArea1();">Toggle DIV Editor</button>
  19. <br /><br />
  20. <h4>Textarea Example</h4>
  21. <div>
  22. <textarea style="width: 300px; height: 100px;" id="myArea2"></textarea>
  23. <br />
  24. <button onClick="addArea2();">Add Editor to TEXTAREA</button> <button onClick="removeArea2();">Remove Editor from TEXTAREA</button>
  25. </div>
  26. <div style="clear: both;"></div>
  27. <script src="../nicEdit.js" type="text/javascript"></script>
  28. <script>
  29. var area1, area2;
  30. function toggleArea1() {
  31. if(!area1) {
  32. area1 = new nicEditor({fullPanel : true}).panelInstance('myArea1',{hasPanel : true});
  33. } else {
  34. area1.removeInstance('myArea1');
  35. area1 = null;
  36. }
  37. }
  38. function addArea2() {
  39. area2 = new nicEditor({fullPanel : true}).panelInstance('myArea2');
  40. }
  41. function removeArea2() {
  42. area2.removeInstance('myArea2');
  43. }
  44. bkLib.onDomLoaded(function() { toggleArea1(); });
  45. </script>
  46. </div>
  47. </body>
  48. </html>