一组radiobutton 控制 javascript如何来实现
我说一下需求
10行radiobutton ,1行4个。
当用户点某行radiobutton,那么该行和列的radiobutton都不再可选。
也就是说, 用户最多只能选择4个radiobutton,
而且这4个radiobutton都在不同的行列。问javascript如何来实现?
我说一下需求
10行radiobutton ,1行4个。
当用户点某行radiobutton,那么该行和列的radiobutton都不再可选。
也就是说, 用户最多只能选择4个radiobutton,
而且这4个radiobutton都在不同的行列。问javascript如何来实现?
比如第一行为11,12,13,14
第二行的为:21,22,23,24
。
点击一个后,通过js来判断哪些变为可选或者不可选。例如点击名字为23的radiobutton,就把2开头的和3结尾的都变为不可选(除了你点击的那个)。思路就是这样,代码应该很好写吧。
否则也不会寻求帮助
至于列不能选择的问题,你可以让每列的radio的Id起的有规律些,如A1,A2....
这样你就可以循环遍历,如果一旦选中一个,其他就是非选中。
这里click函数如何写啦?
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ϟ±덢τµµ</title>
<script language="javascript">
function controlWindow(){
var myRadios=document.getElementsByName("myRadio");
//if(myRadios[0].checked==true)
//window.open();
//else
//window.close();
for(int i=0;i<3;i++)
{
//alert(窗体名.??.value);
if(myRadios[i].checked==true)
}
</script>
</head>
<form name="form1">
<body>
<input type="radio" name="myRadio11" value="1" onclick="controlWindow()"/>11
<input type="radio" name="myRadio12" value="2" onclick="controlWindow()"/>12
<input type="radio" name="myRadio13" value="3" onclick="controlWindow()"/>13
<input type="radio" name="myRadio21" value="4" onclick="controlWindow()"/>21
<input type="radio" name="myRadio22" value="5" onclick="controlWindow()"/>22
<input type="radio" name="myRadio23" value="6" onclick="controlWindow()"/>23
<input type="radio" name="myRadio31" value="7" onclick="controlWindow()"/>31
<input type="radio" name="myRadio32" value="8" onclick="controlWindow()"/>32
<input type="radio" name="myRadio33" value="9" onclick="controlWindow()"/>33
</body>
</form>
</html>
中间不知道如何写?