Java Reference
In-Depth Information
Radio buttons can also be checked initially using the "checked" attribute in the HTML:
<input type="radio" name="type" value="Villain" checked>
Hidden Input Fields
Hidden fields can be created using input fields with type="hidden" . These are not dis-
played by the browser but have a " value " attribute that can contain information that is
submitted with the form. They are often used to send information such as settings or in-
formation that the user has already provided. Note that the information in these fields is in
no way secret as it is visible in the HTML, so they shouldn't be used for sensitive data. The
value of a hidden input field can be changed using JavaScript.
File Input Fields
A file input field can be created using input fields with type="file" . They are used to
upload files and most browsers will provide a Browse button or similar that lets users select
a file from their file system.
Note: HTML5 Input Types
There are lots of new input types included in HTML5 such as number ,
tel , and color . As browsers start to support these, they will implement
different user interface elements depending on the input type. So a number
field might use a slider, whereas a date field will show a calendar. They will
also validate automatically, so an email input field will show an error mes-
sage if it there is no valid email address.
Let's add an input type of " number " to our form. Add the following to
hero.htm:
<label for="age" class="break">Age:</label>
<input type="number" name="age" min=0 step=1>
Number input fields also have optional min and max attributes that can be
used to limit the input given. The step attribute is used to specify how
 
Search WWH ::




Custom Search