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