<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
>
< HTML >
< HEAD >
< TITLE > New Document </ TITLE >
< META NAME ="Generator" CONTENT ="EditPlus" >
< META NAME ="Author" CONTENT ="" >
< META NAME ="Keywords" CONTENT ="" >
< META NAME ="Description" CONTENT ="" >
</ HEAD >
< BODY >
< script language ="javascript" > ...
//代码说明(lulu163.com):form1为表单名,memberId为复选框,selectbutton为全选按钮
function selectAll()
...{
for (var i=0;i<document.form1.memberId.length;i++) ...{
var temp=document.form1.memberId[i];
temp.checked=!temp.checked;
}
if (document.form1.selectButton.value=="全部选择")
...{
document.form1.selectButton.value="取消全选";
}
else
...{
document.form1.selectButton.value="全部选择";
}
}
</ script >
< FORM name ="form1" METHOD =POST ACTION ="" >
复选框(一个例子)
< input name ="memberId" type ="checkbox" value ="1" >
< input name ="memberId" type ="checkbox" value ="2" >
< input name ="memberId" type ="checkbox" value ="3" >
< input name ="memberId" type ="checkbox" value ="4" >
< input name ="memberId" type ="checkbox" value ="5" >
< input name ="memberId" type ="checkbox" value ="6" >
全选按钮:
< input type ="button" name =selectButton value ="全部选择" onClick ="selectAll()" style ="cursor:hand;" >
</ FORM >
</ BODY >
</ HTML >
< HTML >
< HEAD >
< TITLE > New Document </ TITLE >
< META NAME ="Generator" CONTENT ="EditPlus" >
< META NAME ="Author" CONTENT ="" >
< META NAME ="Keywords" CONTENT ="" >
< META NAME ="Description" CONTENT ="" >
</ HEAD >
< BODY >
< script language ="javascript" > ...
//代码说明(lulu163.com):form1为表单名,memberId为复选框,selectbutton为全选按钮
function selectAll()
...{
for (var i=0;i<document.form1.memberId.length;i++) ...{
var temp=document.form1.memberId[i];
temp.checked=!temp.checked;
}
if (document.form1.selectButton.value=="全部选择")
...{
document.form1.selectButton.value="取消全选";
}
else
...{
document.form1.selectButton.value="全部选择";
}
}
</ script >
< FORM name ="form1" METHOD =POST ACTION ="" >
复选框(一个例子)
< input name ="memberId" type ="checkbox" value ="1" >
< input name ="memberId" type ="checkbox" value ="2" >
< input name ="memberId" type ="checkbox" value ="3" >
< input name ="memberId" type ="checkbox" value ="4" >
< input name ="memberId" type ="checkbox" value ="5" >
< input name ="memberId" type ="checkbox" value ="6" >
全选按钮:
< input type ="button" name =selectButton value ="全部选择" onClick ="selectAll()" style ="cursor:hand;" >
</ FORM >
</ BODY >
</ HTML >