jqueryCompleteDemo.html 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <title>使用jquery的完整demo</title>
  6. <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
  7. <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js" charset=""></script>
  8. <script type="text/javascript" charset="utf-8" src="../ueditor.config.js"></script>
  9. <script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
  10. <script>
  11. $(function(){
  12. var ue = UE.getEditor('myEditor');
  13. $('#btn').click(function(){
  14. //手动提交需要手动同步编辑器数据
  15. ue.sync();
  16. $('#form')[0].submit();
  17. });
  18. //--自动切换提交地址----
  19. var version = ue.options.serverUrl || ue.options.imageUrl || "php",
  20. form=$('#form')[0];
  21. if(version.match(/php/)){
  22. form.action="./server/getContent.php";
  23. }else if(version.match(/net/)){
  24. form.action="./server/getContent.ashx";
  25. }else if(version.match(/jsp/)){
  26. form.action="./server/getContent.jsp";
  27. }else if(version.match(/asp/)){
  28. form.action="./server/getContent.asp";
  29. }
  30. })
  31. </script>
  32. </head>
  33. <body>
  34. <form id="form" method="post" target="_blank">
  35. <script type="text/plain" id="myEditor" name="myEditor">
  36. <p>欢迎使用UEditor!</p>
  37. </script>
  38. <input type="button" id="btn" value="提交数据">
  39. </form>
  40. </body>
  41. </html>