submitFormDemo.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
  6. <title></title>
  7. <script type="text/javascript" charset="utf-8" src="../editor_config.js"></script>
  8. <!--使用版-->
  9. <!--<script type="text/javascript" charset="utf-8" src="../editor_all.js"></script>-->
  10. <!--开发版-->
  11. <script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
  12. <link rel="stylesheet" type="text/css" href="../themes/default/ueditor.css"/>
  13. <style type="text/css">
  14. body{
  15. font-size:14px;
  16. }
  17. </style>
  18. </head>
  19. <body>
  20. <h1>UEditor提交示例</h1>
  21. <form id="form" method="post" action="../php/getContent.php">
  22. <p style="color:red">给容器name,那么在后台就可以按着name给的键值在后台一次取的编辑器的值</p>
  23. <!--style给定宽度可以影响编辑器的最终宽度-->
  24. <script type="text/plain" id="myEditor" name="myEditor"style="width:1000px">
  25. <p>这里我可以写一些输入提示</p>
  26. </script>
  27. <p>&nbsp;&nbsp;</p>
  28. <textarea id="myEditor1" name="myEditor1" style="width:600px;">编辑器2</textarea>
  29. <p>直接提交<input type="submit" id="submitInner" value="表单内部提交" /></p>
  30. </form>
  31. 手动调用form的submit方法提交需要使用sync方法<input type="button" value="手动提交" onclick="sync()" />
  32. <script type="text/javascript">
  33. var editor_a = new baidu.editor.ui.Editor();
  34. editor_a.render( 'myEditor' );
  35. var editor_a1 = new baidu.editor.ui.Editor();
  36. editor_a1.render( 'myEditor1' );
  37. //同步
  38. function sync(){
  39. editor_a.sync();
  40. editor_a1.sync();
  41. document.getElementById('form').submit()
  42. }
  43. </script>
  44. </body>
  45. </html>