---
title: "Input[type=\"radio\"]和Input[type=\"checkbox\"]的选中"
author: "wsj123"
date: "2017-11-01T17:03:38Z"
tags: ["CSS", "HTML"]
categories: ["Web前端"]
slug: "input-type-radio-input-type-checkbox"
draft: false
lastmod: "2017-11-01T17:03:38Z"
id: 2398339
url: "https://wsj123.iteye.com/blog/2398339"
---

\[align=center]\[size=x-large]Input\[type="radio"]和Input\[type="checkbox"]的选中\[/size]\[/align] \[b]1.1 Input\[type="radio"]的选中\[/b] 多个单选框同时使用，要形成只能单选的效果时，必须name 值是一样的，某一个选中框要用checked属性。 \[color=red]注意：应该写成的形式，而不用checked="true"的形式。\[/color] \[b]1.2 Input\[type="checkbox"]的选中\[/b] 是复选框，无法形成只能单选的效果，即使name 值是一样的。如果要使其处于选中状态，则使用checked属性。