HTML Select Input;
What is it?
- Select tags are great for providing your user with a drop down list of options that they can select
- The select tag goes hand-in-hand with the option tag which makes sense because a list provides a series of options.
- Similiar to other form tags, there are additional parameters like (Id, Name, Value)
Syntax:
- Select: <Select name='pokemon' id='pokemon_select' >
- Option: <Option value='Charizard'> Charizard </option>
- Option: <Option value='Mewtwo'> Mewtwo</option>
- Option: <Option value='Blastoise'> blastoise </option>
- Option: <Option value='Venusaur'> Venusaur </option>
- Option: <Option value='Arceus'> Arceus </option>
- Option: <Option value='Raquaza'> Raquaza </option>
- Select: </Select>
Basic Checkbox Example :
<form action='transmitmydata.php' method='post' >
Red <input type='checkbox' id='red' name='color' checked>
Blue <input type='checkbox' id='blue' name='color' checked>
Green <input type='checkbox' id='green' name='color' checked>
<input type='button' value='Submit'>
</form>
|
What's happening in the script above?
- The above form has 3 checkboxes and 1 submit button
- Each checkbox has their own id value which is really useful when using JavaScript. JavaScript will allow you access each checkbox using the following command.
- <script> x = document.getElementById("red").value <script>
- Also in this example, all the checkboxes are by default "checked" you could just as easily remove that word, and the checkboxes will default to empty.
Example Output:
See also; HTML Form
See also; HTML Buttons
See also; HTML Table