javascript radio 联动效果
时间:2021-07-01 10:21:17
帮助过:23人阅读
<script>
function checkradio(o,x){
document.getElementsByName("inptB")[x-1].checked=o.checked
}
</script>
<input name="inptA" type="radio" id="inptA" onclick="checkradio(this,1)">aaa
<input name="inptA" type="radio" id="inptA" onclick="checkradio(this,2)">bbb
<input name="inptA" type="radio" id="inptA" onclick="checkradio(this,3)">ccc
<br>
<input name="inptB" type="radio" id="inptB">111
<input name="inptB" type="radio" id="inptB">222
<input name="inptB" type="radio" id="inptB">333