Use radio butto...LOGIN

Use radio buttons and check boxes

When using forms to design questionnaires, in order to reduce user operations, it is a good idea to use select boxes. There are two types of select boxes in HTML, namely Radio button box and Checkbox, the difference between the two is that the user can only select one option in the Radio button, while the user can select as many as they want in the Checkbox items, or even select all. Please see the following example:

Syntax:

<input   type="radio/checkbox"   value="值"    name="名称"   checked="checked"/>

1, type:

When type="radio" , the control is radio button

When type="checkbox", the control is checkbox

2, value: The value of submitting data to the server (used by background program PHP)

3, name: Name the control, In preparation for the use of background programs ASP and PHP

4, checked: When checked="checked" is set, this option is selected by default

As shown in the following code:

Results displayed in the browser:

Note: Same group# For ## radio buttons, the name value must be consistent with . For example, the above example has the same name "radioLove", so that radio buttons in the same group can play the role of radio selection.

Next Section
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>单选框、复选框</title> </head> <body> <form action="save.php" method="post" > <label>性别:</label> <label>男</label> <input type="radio" value="1" name="sex" /> <label>女</label> <input type="radio" value="2" name="sex" /> </form> </body> </html>
submitReset Code
ChapterCourseware