formAction-attribute.html 825 B

12345678910111213141516171819
  1. <!DOCTYPE html>
  2. <script src="../include.js"></script>
  3. <button formaction="http://www.example.com/"></button>
  4. <script>
  5. test(() => {
  6. const elementNames = [
  7. "button",
  8. ];
  9. for (const elementName of elementNames) {
  10. const element = document.querySelector(elementName);
  11. println(`${elementName}.formAction initial value: ${element.formAction}`);
  12. element.formAction = "";
  13. println(`Final segment of ${elementName}.formAction after setting to the empty string: ${element.formAction.split('/').pop()}`);
  14. element.formAction = "../test.html";
  15. println(`Final segment of ${elementName}.formAction after setting to "../test.html": ${element.formAction.split('/').pop()}`);
  16. element.remove();
  17. }
  18. });
  19. </script>