onload.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Onload - Editor.md examples</title>
  6. <link rel="stylesheet" href="css/style.css" />
  7. <link rel="stylesheet" href="../css/editormd.css" />
  8. <link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
  9. </head>
  10. <body>
  11. <div id="layout">
  12. <header>
  13. <h1>Onload event</h1>
  14. <p>Plaese press F12, open the develop tools.</p>
  15. </header>
  16. <div id="test-editormd">
  17. <textarea style="display:none;">#### Setting
  18. ```javascript
  19. {
  20. onload : function() {
  21. // alert("onload");
  22. // this.setMarkdown("### onloaded");
  23. // console.log("onload =>", this, this.id, this.settings);
  24. }
  25. }
  26. ```
  27. </textarea>
  28. </div>
  29. </div>
  30. <script src="js/jquery.min.js"></script>
  31. <script src="../editormd.js"></script>
  32. <script type="text/javascript">
  33. $(function() {
  34. var testEditor = editormd("test-editormd", {
  35. width : "90%",
  36. height : 720,
  37. //watch : false,
  38. //matchWordHighlight : "onselected",
  39. path : '../lib/',
  40. onload : function() {
  41. //this.watch();
  42. //this.setMarkdown("###test onloaded");
  43. //testEditor.setMarkdown("###Test onloaded");
  44. alert("onloaded");
  45. console.log("onloaded =>", this, this.id, this.settings);
  46. }
  47. });
  48. });
  49. </script>
  50. </body>
  51. </html>