码迷,mamicode.com
首页 > 其他好文 > 详细

多选框

时间:2014-11-08 19:34:27      阅读:211      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   color   ar   java   sp   for   

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>复选框全选、全不选和反选的效果实现</title>
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function checkAll() {
for (var j = 1; j <= 9; j++) {
box = eval("document.checkboxform.C" + j); 
if (box.checked == false) box.checked = true;
   }
}

function uncheckAll() {
for (var j = 1; j <= 9; j++) {
box = eval("document.checkboxform.C" + j); 
if (box.checked == true) box.checked = false;
   }
}

function switchAll() {
for (var j = 1; j <= 9; j++) {
box = eval("document.checkboxform.C" + j); 
box.checked = !box.checked;
   }
}
//  End -->
</script>
</head>

<body>

<form name=checkboxform>
<input type=checkbox name=C1 checked>C1<br>
<input type=checkbox name=C2 checked>C2<br>
<input type=checkbox name=C3 checked>C3<br>
<input type=checkbox name=C4 checked>C4<br>
<input type=checkbox name=C5 checked>C5<br>
<input type=checkbox name=C6 checked>C6<br>
<input type=checkbox name=C7 checked>C7<br>
<input type=checkbox name=C8 checked>C8<br>
<input type=checkbox name=C9 checked>C9<br>
<br>
<input type=button value="全部选中" onClick="checkAll()"><br>
<input type=button value="全部不选" onClick="uncheckAll()"><br>
<input type=button value="选择转换" onClick="switchAll()"><br>
</form>
<p><a href="http://www.lanrentuku.com" target="_blank">懒人图库</a></p>
</body>
</html>

 

多选框

标签:style   blog   http   io   color   ar   java   sp   for   

原文地址:http://www.cnblogs.com/laohan110/p/4083802.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!