form-image-submission.html 947 B

12345678910111213141516171819202122232425262728293031323334
  1. <head>
  2. <!--
  3. These style rules ensure the (x,y) coordinates clicked below are the same as the resulting
  4. coordinates in the form submission event.
  5. -->
  6. <style type="text/css">
  7. dialog {
  8. margin: 0;
  9. padding: 0;
  10. }
  11. </style>
  12. </head>
  13. <dialog id="dialog" open>
  14. <form id="form" method="dialog">
  15. <input value="well hello friends!" />
  16. <input id="image" type="image" src="../../../Layout/input/120.png" />
  17. </form>
  18. </dialog>
  19. <script src="../include.js"></script>
  20. <script>
  21. asyncTest(done => {
  22. let dialog = document.getElementById("dialog");
  23. let image = document.getElementById("image");
  24. dialog.addEventListener("close", e => {
  25. println(dialog.returnValue);
  26. done();
  27. });
  28. const imageRect = image.getBoundingClientRect();
  29. internals.click(imageRect.x + 10, imageRect.y + 20);
  30. });
  31. </script>