036a-post.html 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>036a post</title>
  6. <style>
  7. html, body { margin: 0; padding: 0; background: #ffffff; color: #202020; }
  8. body { font-family: sans-serif; font-size: 13px; padding: 10px; }
  9. h1 { font-size: 20px; margin: 0 0 6px 0; }
  10. p { margin: 0 0 10px 0; }
  11. label { margin-right: 8px; }
  12. input, button { font-family: sans-serif; font-size: 13px; }
  13. </style>
  14. </head>
  15. <body>
  16. <h1>036a &middot; POST form submission</h1>
  17. <p>This local page cannot POST; it redirects the form to the test server.</p>
  18. <form id="f" method="post" action="http://10.0.2.2:8765/echo">
  19. <label>Alpha <input id="alpha" name="alpha" value="one"></label>
  20. <label><input id="beta" name="beta" type="checkbox"> Beta</label>
  21. <button id="go" type="submit" name="send" value="yes">Send</button>
  22. </form>
  23. <p>The script sets the fields and submits via <code>form.submit()</code>.</p>
  24. <script>
  25. setTimeout(function () {
  26. var f = document.getElementById('f');
  27. document.getElementById('alpha').value = 'two';
  28. document.getElementById('beta').checked = true;
  29. f.submit();
  30. }, 700);
  31. </script>
  32. </body>
  33. </html>