7. Combo Box
Join the Discussion
Strangely, HTML doesn't provide a combo box so in order to use one for our navigation we must first create one. For those of you who don't know what a combo box is, a combo box is a combination of two field types into one - the input field and the selection list. It is because it is effectively two fields combined together that it gets the name combo box.
So how do we create the combo box? Well here's the code for the one I have above:
<input type="text" name="state" value=""
size="10" /><br />
<select name="s" size="1"
onchange="document.ex.state.value = document.ex.s.options[document.ex.s.selectedIndex]
<option value=" " selected="selected">
To create your own combo box for whatever you want to use it for all you have to do is to copy the above code and substitute your selectable values for the ones shown in italics. You might also need to adjust the number of non-breaking spaces if you adjust the text field width to get the two fields to align properly.
So I guess it doesn't matter too much that HTML left out the combo box from their list of form fields because you can always create your own.
The final step is to adapt the combo box so that we can use it as a Combo Navigator. We'll look at how to do this next.
Note that the script and the descriptions of the functions that it contains are rewritten from the "Ask Felgall" website with the permission of the copyright owner.