Home and Learn: Web Design Course

Password Boxes, The Hidden Element

Password Boxes

You can add a password box to your form. This is identical to a text box in its appearance. The only difference is that when you type in the box the characters are replaced by asterisks ( * ). It's important to remember that although a password box hides the text from prying eyes, the data is not encrypted in any way. If you use METHOD=Get instead of Post, the password would show up in the address line of the browser.

The code for a password box is this:

<INPUT TYPE="Password" SIZE="20" MAXLENGTH="8">

The MAXLEGTH attribute is the maximum number of characters that can be entered into the password text box. SIZE is how wide you want the password box to be.

Hidden Elements

You can have something called a Hidden Element on your form. Hidden elements are for your benefit, not your users. You can store information in a hidden element, and then pass the information to a second web page or form.

The Code for a hidden element is this:

<INPUT TYPE="Hidden" NAME="H1" VALUE="Some value">

As the name of the element implies, any data stored in the VALUE attribute does not show up on the page. However, if a viewer clicks View > Source in a browser, your code can be seen, and that includes any values you've hard-coded into the Value attribute of the Hidden element. So you wouldn't use the Hidden element to store sensitive data.

In the next section, you'll learn about HTML 5 forms.

Back to the Home Page


Email us: enquiry at homeandlearn.co.uk