快捷导航
发新帖
返回列表
1 497
电梯直达  跳转到指定楼层

[作业] 8.3作业+疑问

爱笑的绘梨衣|注册会员 |勤币 85 |学币 0
发表于 2016-12-15 09:41 | 复制链接 | 打印 | 上一主题 | 下一主题
请问一下性别那里的单选按钮怎么设置只能选择一个的选项?我在网页里预览的时候勾选了“男”以后再点“女”就会把两个按钮都选中


以下是代码部分

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>8.3表单作业</title>
<style type="text/css">
body {
        background-image: url(images/83-1.jpg);
        background-repeat: no-repeat;
        color: #000000;
        font-family: 微软雅黑;
        font-size: 12px;
        line-height: 25px;
}
#top {
        width: 100%;
        height: 30px;
        margin-top: 70px;
        margin-bottom: 10px;
        text-align: center;
        font-size: 18px;
        line-height: 30px;
        font-weight: bold;
        color: #FFFFFF;
        background-color: #DDAA00;
}
#reg {
        width: 600px;
        margin-top: 20px;
        margin-left: auto;
        margin-right: auto;
        padding-top: 10px;
        padding-right: 10px;
        padding-bottom: 10px;
        padding-left: 10px;
        height: auto;
        border: 1px solid #FDFDFD;
        background-color: rgba(255,255,255,0.30);
}
#reg li {
        height: 35px;
        line-height: 40px;
        list-style-type: none;
        border-bottom: 1px dashed rgba(255,255,255,1.00);
}
#btn {
        text-align: center;
        top: 10px;
}
#yhm, #mm, #qrmm, #zj, #zjhm, #dzyx, #yzm {
        border: 1px solid rgba(0,0,0,1.00);
        background-color: rgba(255,255,255,0.00);
        border-radius: 5px;
}
</style>
</head>

<body>
<div id="top">新用户注册</div>
<div id="reg">
  <li>用 户 名
    <label for="yhm">:</label>
  <input name="yhm" type="text" id="yhm" title="英文字母和数字组合,字符长度为4-20">
英文字母和数字组合,长度4-20个字符</li>
  <li>
    <label for="mm">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:</label>
    <input type="password" name="mm" id="mm">  
  长度6-20个字符,可以有英文字母和数字组成,不得使用空格</li>
  <li>
    <label for="qrmm">确认密码:</label>
    <input type="password" name="qrmm" id="qrmm">
  再次输入用户密码</li>
  <li>
    <label for="zj">证件类别:</label>
    <select name="zj" id="zj">
      <option selected>身份证</option>
      <option>学生证</option>
      <option>护照</option>
      <option>军人证</option>
      <option>其他证件</option>
    </select>
  </li>
  <li>
    <label for="zjhm">证件号码:</label>
    <input type="text" name="zjhm" id="zjhm">
  证件号码用于密码查询,请如实填写</li>
  <li>
    <label for="dzyx">电子邮箱:</label>
    <input type="email" name="dzyx" id="dzyx">
  用于接收各种信息,以及找回密码服务</li>
  <li>
    性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别:
<input name="radio" type="radio" id="radio" value="radiobutton1" checked>
    <label for="radio">男 </label>
    <input type="radio" name="radio2" id="radio2" value="radiobutton2">
    <label for="radio2">女</label>
  </li>
  <li>验 证 码
    <label for="yzm">:</label>
    <input type="text" name="yzm" id="yzm">
  </li>
  <div id="btn">
    <input type="image" name="imageField" id="imageField" src="images/83-2.png">
  </div>
</div>
</body>
</html>


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
举报 使用道具
| 回复

共1个回复 最后回复于 2016-12-16 17:18

勤币 614   学币 0  
沙发
发表于 2016-12-16 17:18:52 | 只看该作者
既然是单选,那么name当然只有一个,选其中一个,选了第一就不能选第二,选了第二就不能选第一。

你把name的值改成相同的就可以了。
举报 使用道具
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表