Suppose you want to add something like this to the form now: browse the city you are in. Let’s not talk about the whole country, but only dozens of cities above the provincial capital. If the radio button form mentioned above is listed all these cities on the web page, it would be unimaginable. So a menu and a list appear in the form object. After all, menus and lists are mainly generated to save space on web pages.
Menu is the most space-saving way. Under normal conditions, you can only see one option. You can only see all options after clicking the button to open the menu. The list can display a certain number of options. If this number exceeds, a scroll bar will automatically appear. Viewers can view each option by dragging the scroll bar. The menu and list effects on the page can be designed through the <select> and <option> tags.
The meaning of these properties is shown in the following table
| Menu and list tags | describe |
|---|---|
| name | Menu and list names |
| size | Number of options displayed |
| multiple | Multiple selection of items in the list |
| value | Option value |
| selected | Default options |
Insert menus and lists in the page.
01 <!-- ------------------------------ -->
02 <!-- File example: 11-16.htm -->
03 <!-- File Description: Insert Menu and List-->
04 <!-- ------------------------------ -->
05 <title>
06 <head>
07 <title>Insert menu and list</title>
08 </head>
09 <body>
10 <h1>User Survey</h1>
11 <Form action=mailto:[email protected] method=get name=invest>
12 Please select the music you like: <br>
13 <select name=music size=4 multiple>
14 <option value=rock Selected>Rock
15 <option value=pop>Pop
16 <option value=jazz>jazz
17 <option value=nation>Ethnic Music
18 </select><br>
19 Please select the city you live in: <br>
20 <select name=city>
21 <option value=beijing selected>Beijing
22 <option value=shanghai>Shanghai
23 <option value=nanjing>Nanjing
24 <option value=guangzhou>Guangzhou
25 </select>
26 <input type=submit name=submit value=submit form>
27 </Form>
28 </body>
29 </html>
Line 13 defines the list display number of items to 4 and can be multiple choices. Lines 14 to 17 define options, where Rock Music is the default selection, line 20 defines the default number of menus, line 21 to 24 define options, where Beijing is the default selection. 2 pages in total Previous page 12 Next page