OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Creates the following form: |
| 6 // <form action="done.html"> |
| 7 // <label for="username">Username</label> |
| 8 // <input type="text" id="username" name="username"> |
| 9 // <label for="password">Password</label> |
| 10 // <input type="password" id="password" name="password"> |
| 11 // <input type="submit" id="submit-button"> |
| 12 // </form> |
| 13 function createSimplePasswordForm() { |
| 14 var form = document.createElement('form'); |
| 15 form.setAttribute('action', 'done.html'); |
| 16 |
| 17 var username_label = document.createElement('label'); |
| 18 username_label.htmlFor = 'username'; |
| 19 username_label.innerText = 'Username: '; |
| 20 var username = document.createElement('input'); |
| 21 username.type = 'text'; |
| 22 username.name = 'username'; |
| 23 username.id = 'username'; |
| 24 |
| 25 var password_label = document.createElement('label'); |
| 26 password_label.innerText = 'Password: '; |
| 27 password_label.htmlFor = 'password'; |
| 28 var password = document.createElement('input'); |
| 29 password.type = 'password'; |
| 30 password.name = 'password'; |
| 31 password.id = 'password'; |
| 32 |
| 33 var submit = document.createElement('input'); |
| 34 submit.type = 'submit'; |
| 35 submit.id = 'submit-button'; |
| 36 submit.value = 'Submit'; |
| 37 |
| 38 form.appendChild(username_label); |
| 39 form.appendChild(username); |
| 40 form.appendChild(password_label); |
| 41 form.appendChild(password); |
| 42 form.appendChild(submit); |
| 43 |
| 44 return form; |
| 45 } |
OLD | NEW |