A menu is very much like a list. The markup is nearly exactly the same, and you use menus to present a large number of options, just like a list. The main difference is that the options appear in a dropdown list, as in Figure 68.7.
<form> <table> <tr> <td>Select the newsletter you would like to receive:</td> </tr> <tr> <td><select name="select"> <option value="news" selected>News</option> <option value="sports">Sports</option> <option value="business">Business</option> <option value="entertainment">Entertainment</option> <option value="humor">Humor</option> <option value="style">Style</option> <option value="travel">Travel</option> <option value="science">Science</option> <option value="culture">Culture</option> </select></td> </tr> </table> </form>
Look very carefully in the View Source for Figure 68.7, and you see that what makes the difference between a menu and a list is the absence of the size attribute in the select tag.
TIP
You should always preselect one option in a menu. Otherwise, the menu appears blank until the visitor opens the dropdown list. |
Otherwise, the attributes in a menu are identical in number and function, and the data that the Web server receives looks much the same. In addition, you can add the multiple and selected attributes to the select and option tags of a menu, just as in a list, although doing this turns the menu into a list.