XHTML » input » type="password"

The type="password" control displays a one line input window which is used to collect a password as a masked text. A masked text means that when the user types in the password, the actual characters being typed do not appear in the window. Rather an asterisk * is displayed in place of each character in the password.

You can use a type="text" control to gather the user name.

The default window size is browser dependent and is usually 20-30 characters in length. However, you can set the size using style sheets or the size attribute. The maxlength attribute can be used to set the maximum number of characters that will be accepted by the control (field).

This is only a semi-secure method for gathering a password. While the password is not visible on screen, when the form is submitted, the password is passed unencrypted as part of the contents of the form.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<title>DevGuru XHTML input Tag Example</title>
<input type="password" />
Language(s): HTML