单选框的选择问题 都是a组的,又是单选框,如何实现全选?? 如果改组名,那还不如用checkbox. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <br><input type=checkbox name="a">a <input type=checkbox name="b">b<br><input type=checkbox name="a">a <input type=checkbox name="b">b<br><input type=checkbox name="a">a <input type=checkbox name="b">b<br><input type=checkbox name="a">a <input type=checkbox name="b">b<br><input type=checkbox name="a">a <input type=checkbox name="b">b<br><input type=checkbox name="a">a <input type=checkbox name="b">b<br>全选A<input type=checkbox onclick="selectAllCheckboxes('a',this.checked);"><br>全选B<input type=checkbox onclick="selectAllCheckboxes('b',this.checked);"><script>/*** This function is to change all checkboxes to checked or unchecked.* JK 2003-12-08*/function selectAllCheckboxes(nameOfCheckBox,trueOrFalse){ if(trueOrFalse==null) trueOrFalse=true; var theCheckboxInputs=document.getElementsByName(nameOfCheckBox); for (var i=0;i<theCheckboxInputs.length;i++) theCheckboxInputs[i].checked=trueOrFalse;}</script> function selecta(){ var objs = document.getElementsByName('a'); var i=0; for(i = 0 ; i < objs.length ; i ++) { if(objs[i].checked ==true) { objs[i].checked =false; } else { objs[i].checked =true; } }}function selectb(){ var objs = document.getElementsByName('b'); var i=0; for(i = 0 ; i < objs.length ; i ++) { if(objs[i].checked ==true) { objs[i].checked =false; } else { objs[i].checked =true; } }} <br><input type=radio name="a1">a <input type=radio name="a1">b<br><input type=radio name="a2">a <input type=radio name="a2">b<br><input type=radio name="a3">a <input type=radio name="a3">b<br><input type=radio name="a4">a <input type=radio name="a4">b<br><input type=radio name="a5">a <input type=radio name="a5">b<br><input type=radio name="a6">a <input type=radio name="a6">b<br>全选A<input type=radio name=JK onclick="selectAll(0)"><br>全选B<input type=radio name=JK onclick="selectAll(1)"><script>function selectAll(redioIndex){for(var i=1;i<7;i++) document.all("a"+i)[redioIndex].checked=true;}</script> radio 用来使用户来单选一个选项的checkbox 使用来给用户进行多选的!楼主何必非要绕弯路呢! 谷歌的chrome浏览器调js真好 如何改变后台映射到前台的字体大小? js变量转换成服务器端脚本.. 求文本框验证代码,就是注册时限制字数,禁止不填的代码 一个小问题.进来有奖哦 关于函数调用? 帮帮我,这条javascript语句怎么写,不难,可是我不会!!! 这里该如何传递,请各位指点! 有没有什么方法能计算出两个日期间包含多少个星期一,星期二,星期三。。。 js 调用诡异。 请问怎么样得到多行文本框中光标的位置/选择的文本? 那里有试题??
<br><input type=checkbox name="a">a <input type=checkbox name="b">b
<br><input type=checkbox name="a">a <input type=checkbox name="b">b
<br><input type=checkbox name="a">a <input type=checkbox name="b">b
<br><input type=checkbox name="a">a <input type=checkbox name="b">b
<br><input type=checkbox name="a">a <input type=checkbox name="b">b
<br><input type=checkbox name="a">a <input type=checkbox name="b">b
<br>全选A<input type=checkbox onclick="selectAllCheckboxes('a',this.checked);">
<br>全选B<input type=checkbox onclick="selectAllCheckboxes('b',this.checked);"><script>
/**
* This function is to change all checkboxes to checked or unchecked.
* JK 2003-12-08
*/
function selectAllCheckboxes(nameOfCheckBox,trueOrFalse)
{
if(trueOrFalse==null) trueOrFalse=true;
var theCheckboxInputs=document.getElementsByName(nameOfCheckBox);
for (var i=0;i<theCheckboxInputs.length;i++)
theCheckboxInputs[i].checked=trueOrFalse;
}
</script>
{
var objs = document.getElementsByName('a');
var i=0;
for(i = 0 ; i < objs.length ; i ++)
{
if(objs[i].checked ==true)
{
objs[i].checked =false;
}
else
{
objs[i].checked =true;
}
}
}function selectb()
{
var objs = document.getElementsByName('b');
var i=0;
for(i = 0 ; i < objs.length ; i ++)
{
if(objs[i].checked ==true)
{
objs[i].checked =false;
}
else
{
objs[i].checked =true;
}
}
}
<br><input type=radio name="a2">a <input type=radio name="a2">b
<br><input type=radio name="a3">a <input type=radio name="a3">b
<br><input type=radio name="a4">a <input type=radio name="a4">b
<br><input type=radio name="a5">a <input type=radio name="a5">b
<br><input type=radio name="a6">a <input type=radio name="a6">b
<br>全选A<input type=radio name=JK onclick="selectAll(0)">
<br>全选B<input type=radio name=JK onclick="selectAll(1)"><script>function selectAll(redioIndex)
{
for(var i=1;i<7;i++)
document.all("a"+i)[redioIndex].checked=true;
}
</script>