<input type=checkbox onclick="aa()" name=a>
<input type=checkbox name=a>
<input type=checkbox name=a>
<input type=checkbox name=a>
<script>
function aa()
{
l=document.getElementsByName("a")
for(i=0;i<l.length;i++) l[i].checked=event.srcElement.checked
}
</script>
<input type=checkbox name=a>
<input type=checkbox name=a>
<input type=checkbox name=a>
<script>
function aa()
{
l=document.getElementsByName("a")
for(i=0;i<l.length;i++) l[i].checked=event.srcElement.checked
}
</script>
解决方案 »
- 关于下载文件时长文件名的问题.如何修改HttpResponseHeaders的编码
- javascript取中文的unicode值
- JavaScript中的onmouseover事件
- 求 某字符前后 非 字母、数字、标点符号、a> 的正则表达式
- ajax返回值不能更新啊!或者说js中的变量不更新啊!
- js给c#.net返回值的问题?!
- jquery 为啥赋值错误
- 小妹求助2,下拉菜单的触发如何实现!
- 关于javascript中的数组定义?
- 页面的打印问题
- 在网页中如何用图形显示实时数据(最好用javascript)
- 请问谁用过选项卡控件设制多个不同的页面对不同tab页面的内容保存到数据库保存/在线!!
<input type=checkbox name=c>
<input type=checkbox name=c>
<input type=checkbox name=c>
<input type=checkbox name=c>
<input type=checkbox name=c>
<input type=checkbox name=c>
<input type=checkbox name=c>
<input type=checkbox name=c>
<script>
document.onclick=check;
function check(){
var num=0;
for (i=0;i<document.all.c.length;i++){
if(document.all.c[i].checked){
num++
if (num>1){//可以设置个数
event.returnValue=false;
}
}
}
}
</script>
<input type=checkbox name=mm onclick=aa(this)><br>
<input type=checkbox name=mm><br>
<input type=checkbox name=mm><br>
<input type=checkbox name=mm><br>
</form><script language="JavaScript">
<!--
function aa(e)
{
var a = document.form1.elements;
for (var i=0; i<a.length; i++)
if(a[i].type=="checkbox" && a[i].name=="mm")
a[i].disabled = e.checked;
e.disabled = false;
}
//-->
</script>
<input type=checkbox onclick="aa(this)"><input type=checkbox onclick="aa(this)"><input type=checkbox onclick="aa(this)">
<input type=checkbox onclick="aa(this)">
<input type=checkbox onclick="aa(this)">
<input type=checkbox onclick="aa(this)">
<script>
function aa(obj){
var s = document.getElementsByTagName("input");
for(var i =0 ;i<s.length;i++)
{
if(s[i].type=="checkbox")
if(s[i]!=obj)
s[i].disabled = obj.checked?true:false;
}
}
</script>