Setting a Default Value for an Input Box

Another Property you can use with the <INPUT> tag is the VALUE property. The VALUE property is the default value of the field and is also the value that appears in the input box when the form is initially display. The syntax for the VALUE property is:

<INPUT VALUE="value">

where value is the default text or number that will appear in the field. Because Devilish Delights is mainly sold in the United States, you will make the Country field on the contest form have a default value of "United States."

Return to the contestform.html file in your text editor. Type VALUE="United States" in the Country <INPUT> tag as shown below:

<TR>

<TD>Country:</TD>

<TD><INPUT NAME=Country VALUE="United States"></TD>

</TR>

Save your changes, and then reload the file in your browser. Verify the "United States" is now automatically entered into the Country field. If customers from countries outside the United States use this Web form, they can remove the default value by selection the entire text string and pressing the Delete key.