Controlling the Size of an Input Box
By default, the browser made all the input boxes in the registration form the same size-20 characters wide. You can specify a different size. The syntax for changing the size of an input box is:
where value is the size of the input box in number of characters.
To allow for longer names, the First and Last name fields should be increased to 25 characters. Also, the Address box needs to be larger, so you will give it the value of 50 to allow for street number and street names. The State field can be reduced to a size of three characters for state abbreviations, and the size of the Zip field should be reduced to 10 characters. The City and Country fields can remain unchanged, with the default width of 20 characters each.
Return to the contestform.html file in your text editor. For the FirstName and LastName <INPUT> tags, insert the property SIZE=25 as follows:
<TD><INPUT NAME=FirstName SIZE=25>
Continue inserting the property size with the remaining <INPUT> tags:
For the Address <INPUT> tags, insert the property SIZE=25.
For the State <INPUT> tags, insert the property SIZE=3.
For the Zip <INPUT> tags, insert the property SIZE=10.
Save your changes, and then reload the file in your Web browser.
Setting the Maximum Length for Text Input
There will be times when you want to put limitations on the text that can be entered. An example would be if you were asking for a Social Security Number. The syntax for setting the maximum length of the input is:
where value is the maximum length of characters allowed. In the Social Security Number example, the <INPUT> tag might look like the following:
<INPUT NAME=SSNUM SIZE=9 MAXLENGTH=9>