associate-form-controls.html 809 B

1234567891011121314151617181920212223242526272829303132
  1. <html>
  2. <head>
  3. <script>
  4. function addForm()
  5. {
  6. var form = document.createElement("form");
  7. form.id = "login_form";
  8. var usernameField = document.createElement("input");
  9. usernameField.id = "username";
  10. usernameField.type = "text";
  11. form.appendChild(usernameField);
  12. document.body.appendChild(form);
  13. }
  14. function addPasswordFieldToForm()
  15. {
  16. var passwordField = document.createElement("input");
  17. passwordField.id = "password";
  18. passwordField.type = "password";
  19. var form = document.getElementById("login_form");
  20. form.appendChild(passwordField);
  21. }
  22. </script>
  23. </head>
  24. <body onload="addForm()">
  25. <button onclick="addPasswordFieldToForm()">Manual Testing: Add the password field</button>
  26. </body>
  27. </html>