gpt4 book ai didi

html - 无法在 HTML 中的单选按钮之间进行选择?

转载 作者:搜寻专家 更新时间:2023-10-31 02:25:02 28 4
gpt4 key购买 nike

我有以下表单代码,但我无法在 IE 中选择出售电台我可以在 Google Chrome 中同时选择两个 radio 。

<form method="post" action="dothemath.php" style="width: 403px" class="style1">
<input type="radio" id="rdobuy" style="width: 20px; height: 21px;" checked="checked"/>
<label>Buy</label>
<input type="radio" id="rdosell" style="width: 20px; height: 21px;"/>
<label >Sell</label>
</form>

有什么我想念的吗...?

最佳答案

您的单选按钮没有 name属性。他们需要它们有两个原因。

  1. 使用相同的名称将一组单选按钮组合成一个单选组
  2. 名称用于生成提交给服务器的表单数据

您还需要一个 value说明提交的数据是什么。

顺便说一句,你的 <label> s 是无用的,因为它们不与任何控件相关联。他们需要一个 forid 具有相同值的属性他们要关联的控件。

<form method="post" action="dothemath.php">

<input type="radio" id="rdobuy" name="foo" value="buy" checked="checked"/>
<label for="rdobuy">Buy</label>

<input type="radio" name="foo" value="sell" id="rdosell" />
<label for="rdosell">Sell</label>

</form>

关于html - 无法在 HTML 中的单选按钮之间进行选择?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8288350/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com