写一个html关于选项是否单选的节目
时间: 2023-08-05 22:02:59 浏览: 49
好的,这是一个关于选项是否单选的节目的HTML代码示例:
```html
<!DOCTYPE html>
<html>
<head>
<title>选项单选/多选节目</title>
</head>
<body>
<h1>选项单选/多选节目</h1>
<form>
<fieldset>
<legend>请选择您喜欢的水果:</legend>
<input type="radio" name="fruit" id="apple" value="apple">
<label for="apple">苹果</label>
<input type="radio" name="fruit" id="banana" value="banana">
<label for="banana">香蕉</label>
<input type="radio" name="fruit" id="orange" value="orange">
<label for="orange">橙子</label>
</fieldset>
<fieldset>
<legend>请选择您喜欢的颜色:</legend>
<input type="checkbox" name="color" id="red" value="red">
<label for="red">红色</label>
<input type="checkbox" name="color" id="blue" value="blue">
<label for="blue">蓝色</label>
<input type="checkbox" name="color" id="yellow" value="yellow">
<label for="yellow">黄色</label>
</fieldset>
<input type="submit" value="提交">
</form>
</body>
</html>
```
这个节目展示了一个单选框和一个多选框,用户可以选择自己喜欢的水果和颜色。在这个例子中,水果选项是单选的,因为每个单选框都有相同的“name”属性值。而颜色选项是多选的,因为每个复选框都有相同的“name”属性值。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)