javascript radio 联动效果
作者:
js联动效果实现代码
<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
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