JavaScript EditorBest javascript editor debugger     Ajax website 

Main Page

Previous Page
Next Page

Creating Password Boxes

The only difference between a password box and a text box is that whatever is typed in the former is hidden by bullets or asterisks. The information is not encrypted when sent to the server.

Figure 17.18. The name attribute identifies the password when you compile the data.

To create password boxes:

If desired, type the label that will identify the password box to your visitor (for example, Enter password:).

Type <input type="password".

Type name="label", where label is the text that will identify the input data to the server (and your script).

If desired, define the size of the box on your form by typing size="n", replacing n with the desired width of the box, measured in characters.

If desired, type maxlength="n", where n is the maximum number of characters that can be entered in the box.

Finish the text box by typing a final />.

Figure 17.19. When the visitor enters a password in a form, the password is hidden with bullets or asterisks.


  • Even if nothing is entered in the password box, the name is still sent to the server (with an undefined value).

  • You could set default text for value (as in step 4 on page 262), but that kind of defeats the purpose of a password.

  • The only protection the password box offers is from folks peering over your visitor's shoulder as she types in her password. To really protect passwords you have to use them on a secure server.

Previous Page
Next Page

JavaScript EditorBest javascript editor debugger     Ajax website