html input的type类型的选择

图片说明

如图,需要有一个可点击的小圆点(是radio类型吗?),点一下选择后,后面的下拉菜单才可用。再点一下,就如同图中第二排,后面下拉菜单被禁用。





想问一下这个圆点是什么类型的?通过怎样方式来控制后面的下拉单的可使用状态?

<input id="Radio1" type="radio" name="radio" onclick="change(1)" />
<select id="Select1" disabled>
    <option></option>
</select><br/>
<input id="Radio2" type="radio" name="radio" onclick="change(2)" />
<select id="Select2" disabled>
    <option></option>
</select><br />
<input id="Radio3" type="radio" name="radio" onclick="change(3)" />
<select id="Select3" disabled>
    <option></option>
</select><br />
<input id="Radio4" type="radio" name="radio" onclick="change(4)" />
<script>
    function change(id) {
        document.getElementById("Select1").setAttribute("disabled", "disabled");
        document.getElementById("Select2").setAttribute("disabled", "disabled");
        document.getElementById("Select3").setAttribute("disabled", "disabled");
        var Radio = document.getElementById("Select" + id);
        Radio.removeAttribute("disabled");
    }
</script>

首先,单选肯定是radio类型,要想控制后面的下拉菜单的可用和不可用,可以判断当前radio的选中状态,如果选中就让下拉菜单可用,没选就不可用,当然,事先需要将下拉菜单设置为不可用

使用radio,然后用js根据radio值控制后面的下拉框

type类型肯定是radio无疑。先禁用后面的type="text"的框为disabled=true,用js控制,if前面的圆点被选中时将disabled设为block,注意还要else一下disabled=true。