Home >Web Front-end >HTML Tutorial >Usage analysis of radio button control label in html and how to set default selection_html/css_WEB-ITnose

Usage analysis of radio button control label in html and how to set default selection_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-24 11:53:593221browse

Radio object represents a radio button in an HTML form. Each time appears in an HTML form, a Radio object is created. A radio button represents one of a set of mutually exclusive option buttons. When a button is selected, the previously selected button becomes unselected. When a radio button is selected or unselected, the button fires the onclick event handler. You can access the Radio object by iterating over the form's elements[] array, or by using document.getElementById(). Collected and organized by www.169it.com

1. Radio button control syntax

1

1

Use html input tag, name is customized, type type The form for "radio".

2. Radio radio button code example

1

2

3

4

5

6

7

8

您最喜欢水果?

1. HTML code snippet:

1

2

3

学生

教师

管理员

1 2 3 4 5 6 7 8
What is your favorite fruit?

2. Example code snippet 2 (default selected setting example):
1 2 3 Students Teacher Administrator

In the two code examples, checked="checked" indicates the default selected item settings.

3. Code example three (js operation radio):

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

<script></script>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn