OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script> |
| 4 function createDynamicForm() { |
| 5 var dynamicForm = document.createElement('form'); |
| 6 dynamicForm.setAttribute('name', 'dynamic_form'); |
| 7 dynamicForm.setAttribute('method', 'post'); |
| 8 dynamicForm.setAttribute('action', 'done.html'); |
| 9 dynamicForm.setAttribute('onsubmit', 'return true;'); |
| 10 |
| 11 var inputUsername = document.createElement('input'); |
| 12 inputUsername.setAttribute('type', 'text'); |
| 13 inputUsername.setAttribute('name', 'username'); |
| 14 |
| 15 var inputPassword = document.createElement('input'); |
| 16 inputPassword.setAttribute('type', 'password'); |
| 17 inputPassword.setAttribute('name', 'password'); |
| 18 |
| 19 var submitButton = document.createElement('input'); |
| 20 submitButton.setAttribute('type', 'submit'); |
| 21 submitButton.setAttribute('value', 'Submit'); |
| 22 |
| 23 dynamicForm.appendChild(inputUsername); |
| 24 dynamicForm.appendChild(inputPassword); |
| 25 dynamicForm.appendChild(submitButton); |
| 26 |
| 27 document.body.appendChild(dynamicForm); |
| 28 } |
| 29 </script> |
| 30 </head> |
| 31 <body> |
| 32 <input type='button' id='create_form_button' onclick='createDynamicForm()'> |
| 33 </body> |
| 34 </html> |
OLD | NEW |