<script type="text/javascript">
//<![CDATA[
function webchose(webstr)
{
var a=webstr.split(/\s*,\s*/);
for(var i=0, j=a.length; i<j; i++)
{
document.getElementById(a[i]).checked=true;
}
} // shawl.qiu script
//]]>
</script>
<form name=webform action="" method=post>
<table border="0" width="100%" id="table2">
<tr>
<td><input type=checkbox name="WebId" id="W1" value="1">dataa</td>
<td><input type=checkbox name="WebId" id="W21" value="21">datab</td>
<td><input type=checkbox name="WebId" id="W3" value="3">datac</td>
<td><input type=checkbox name="WebId" id="W4" value="4">datad</td>
<td><input type=checkbox name="WebId" id="W25" value="25">datae</td>
<td><input type=checkbox name="WebId" id="W6" value="6">dataf</td>
<td><input type=checkbox name="WebId" id="W7" value="7">datag</td>
<td><input type=checkbox name="WebId" id="W8" value="8">datah</td>
</tr>
</table>
<input type=button value="选定" onclick="webchose('W1,W4,W7');">
</form>
//<![CDATA[
function webchose(webstr)
{
var a=webstr.split(/\s*,\s*/);
for(var i=0, j=a.length; i<j; i++)
{
document.getElementById(a[i]).checked=true;
}
} // shawl.qiu script
//]]>
</script>
<form name=webform action="" method=post>
<table border="0" width="100%" id="table2">
<tr>
<td><input type=checkbox name="WebId" id="W1" value="1">dataa</td>
<td><input type=checkbox name="WebId" id="W21" value="21">datab</td>
<td><input type=checkbox name="WebId" id="W3" value="3">datac</td>
<td><input type=checkbox name="WebId" id="W4" value="4">datad</td>
<td><input type=checkbox name="WebId" id="W25" value="25">datae</td>
<td><input type=checkbox name="WebId" id="W6" value="6">dataf</td>
<td><input type=checkbox name="WebId" id="W7" value="7">datag</td>
<td><input type=checkbox name="WebId" id="W8" value="8">datah</td>
</tr>
</table>
<input type=button value="选定" onclick="webchose('W1,W4,W7');">
</form>
我自己写的时候,这句话写不了document.getElementById(a[i]).checked=true;
<!--
function webchose(webstr)
{
window.document.webform.WebId1.checked=true;
window.document.webform.WebId2.checked=true;
window.document.webform.WebId3.checked=true;
return false;
}
//-->
</script>
</head>
<body>
<form name=webform action="" method=post>
<table border="0" width="100%" id="table2">
<tr>
<td><input type=checkbox name="WebId1" id="W1" value="1">dataa</td>
<td><input type=checkbox name="WebId2" id="W21" value="21">datab</td>
<td><input type=checkbox name="WebId3" id="W3" value="3">datac</td>
<td><input type=checkbox name="WebId4" id="W4" value="4">datad</td>
<td><input type=checkbox name="WebId5" id="W25" value="25">datae</td>
<td><input type=checkbox name="WebId6" id="W6" value="6">dataf</td>
<td><input type=checkbox name="WebId7" id="W7" value="7">datag</td>
<td><input type=checkbox name="WebId8" id="W8" value="8">datah</td>
</tr>
</table>
<input type=button value="选定" onclick="webchose('W1,W4,W7');">
自己修改一下吧!