o = document.getElementsByName("ttt")
for(i=0;i<o.length;i++) o[i].checked=true
for(i=0;i<o.length;i++) o[i].checked=true
解决方案 »
- google浏览器对js下回车事件改变无效
- 菜鸟问题 window.location.href带两个参数怎么写?在线等
- 点击列表框后给文本框赋值_报错
- 新手求助:本人在做一个兑奖功能,若输入的数据错误次数超过5次,则不能继续操作
- 从数据库提取5条符合要求的数据,并将他们分别赋值给5个变量
- 如何执行本页所包含iframe的页面中的一个函数?
- ?表格的两个问题,欢迎大家指点或讨论,希望此贴长存
- 救急!事件问题!!
- 请问版主:不会“把大家讨论一下EtCell报表控件/插件的功能,来者有分!“的贴子也给封杀了吧?
- 请问在javascript中,怎样检测一张图片已经被完全载入页面
- 怎么用JS得到AX控件里的数据??
- 关于复选框提交到数据库的问题,请高手解答!!!
<a href=#>1</a><a href=#>2</a>复选择框:
<INPUT TYPE="checkbox" NAME="ttt1" value="1">test1
<INPUT TYPE="checkbox" NAME="ttt2" value="1">test2
<INPUT TYPE="checkbox" NAME="ttt3" value="1">test3
<INPUT TYPE="checkbox" NAME="ttt4" value="1">test4
<INPUT TYPE="checkbox" NAME="ttt5" value="1">test5
<INPUT TYPE="checkbox" NAME="ttt6" value="1">test6分类打上勾,如点击1,复选框ttt1,ttt3,ttt5打勾
分类打上勾,如点击2,复选框ttt2,ttt4,ttt6打勾
target.checked=true;
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>全选、反选、全不选</title>
<script language="javascript">
<!--
function SelectIterm(form,sign)
{
for (var i=0;i<form.elements.length;i++){
if(form.elements[i].type=='checkbox'){
var e=form.elements[i]
if (sign==0) e.checked=true;
if(sign==1) e.checked=!e.checked;
if(sign==2) e.checked=false;}
}}
-->
</script>
</head>
<body>
<form name="myform" >
<table width="576" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="101" height="27" valign="top"><input type="checkbox" name="checkbox7" value="checkbox"></td>
<td width="111" valign="top"><input type="checkbox" name="checkbox8" value="checkbox"></td>
<td width="364" valign="top"><input type="checkbox" name="checkbox9" value="checkbox"></td>
</tr>
<tr>
<td height="24" valign="top"><input type="checkbox" name="checkbox6" value="checkbox"></td>
<td valign="top"><input type="checkbox" name="checkbox5" value="checkbox"></td>
<td valign="top"><input type="checkbox" name="checkbox4" value="checkbox"></td>
</tr>
<tr>
<td height="25" valign="top"><input type="checkbox" name="checkbox3" value="checkbox"></td>
<td valign="top"><input type="checkbox" name="checkbox2" value="checkbox"></td>
<td valign="top"><input type="checkbox" name="checkbox1" value="checkbox"></td>
</tr>
<tr>
<td height="35" valign="top"><!--DWLayoutEmptyCell--> </td>
<td valign="top"><!--DWLayoutEmptyCell--> </td>
<td valign="top"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="33" valign="top"><!--DWLayoutEmptyCell--> </td>
<td valign="top"><!--DWLayoutEmptyCell--> </td>
<td valign="top"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="35" valign="top"><!--DWLayoutEmptyCell--> </td>
<td valign="top"><!--DWLayoutEmptyCell--> </td>
<td valign="top"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="33" valign="top"><!--DWLayoutEmptyCell--> </td>
<td valign="top"><!--DWLayoutEmptyCell--> </td>
<td valign="top"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="18" valign="top"><!--DWLayoutEmptyCell--> </td>
<td valign="top"><!--DWLayoutEmptyCell--> </td>
<td valign="top"><!--DWLayoutEmptyCell--> </td>
</tr>
</table>
<a href="javascript:SelectIterm(myform,0);">全选</a>
<a href="javascript:SelectIterm(myform,1);">反选</a>
<a href="javascript:SelectIterm(myform,2);">全不选</a>
</form>
</body>
</html>