Switches (radiobutton)
Switches are used when it is necessary to select one single option from the proposed ones. If you want to select several options, you should prefer the checkboxes.
Switches are created as follows.
Field parameters are listed in the table.
Parameter | Description |
---|---|
Name | The name of the field. It is intended for the form handler to be able to identify this field. |
Value | The value of the field determines what will be sent to the server. |
Checked | Sets the default item. |
The name of the field (parameter name ) for all elements of the group must be the same. It is in this case that the browser correctly marks the selected items (example 1).
Example 1. Using switches
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text / html; charset = windows-1251">
<Title> Switches </ title>
</ Head>
<Body>
<Form action = "/ cgi-bin / handler.cgi">
<P> <b> How do you think the abbreviation "OS" stands? </ B> </ p>
<P> <input type = "radio" name = "answer" value = "a1"> Officer composition </ p>
<P> <input type = "radio" name = "answer" value = "a2"> Operating System </ p>
<P> <input type = "radio" name = "answer" value = "a3"> Large striped flies </ p>
</ Form>
</ Html>
As a result, we get the following (Fig. 1).
Fig. 1. Kind of switches
Copyright © www.htmlbook.ru
Comments
When commenting on, remember that the content and tone of your message can hurt the feelings of real people, show respect and tolerance to your interlocutors even if you do not share their opinion, your behavior in the conditions of freedom of expression and anonymity provided by the Internet, changes Not only virtual, but also the real world. All comments are hidden from the index, spam is controlled.