<script language="JavaScript">
function myReset()
{
//form1.reset();
var cbs = document.getElementsByTagName("input");
for(var i=0;i<cbs.length;i++)
{
if(cbs[i].type=="checkbox")
cbs[i].checked=false;
}
}
</script>
<form name="form1" method="post" action="">
  <p>
    <input type="checkbox" name="checkbox" value="checkbox">
    <br>
    <input name="checkbox2" type="checkbox" value="checkbox" checked>
    <br>
    <input type="checkbox" name="checkbox3" value="checkbox">
    <br>
    <input name="checkbox4" type="checkbox" value="checkbox" checked>
    <br>
    <input type="checkbox" name="checkbox5" value="checkbox">
  </p>
  <p>
    <input type="button" name="Reset" value="重新选择" onClick="myReset()">
  </p>
</form>

解决方案 »

  1.   

    我的代码是这样的。为什么不行??按“重新选择”怎样把aa,bb的钩都去掉?
    <html>
    <head>
    <title></title>
    <meta http-e="Content-Type" content="text/htmlquiv; charset=gb2312">
    </head>
    <style>
    td{font-size:9pt}
    body{font-size:10.5pt}
    </style>
    <script>function setInputNull()
    { var cbs = document.getElementsByName("aa"); //var cbs = document.getElementsByTagName("input"); for(var i=0;i<cbs.length;i++)
    {
    cbs[i].checked=false;
    } var cbs = document.getElementsByName("bb"); //var cbs = document.getElementsByTagName("input"); for(var i=0;i<cbs.length;i++)
    {
    cbs[i].checked=false;
    }
    }</script><body bgcolor="#FFFFFF"  >
        <form name="FormSelect"  method="post">
      <table border=0 cellpadding=1 cellspacing=1 align="center">
        <tr bgcolor="#CCCCCC" align="center"> 
                <td align="center" height="25" width="26"><b>序号</b></td>
                <td height="25" width="153"><b>名称</b></td>
                <td height="25" width="55"><b>较好</b></td>
                <td height="25" width="41"><b>较差</b></td>
              </tr>
              <tbody> 
              <tr bgcolor="eeeeee"> 
                <td align="center" bgcolor="eeeeee" width="26"><font color=red>107</font></td>
                <td width="153" bgcolor="eeeeee">公司1</td>
                <td width="55" align="center" bgcolor="eeeeee"> 
                  <input type="checkbox" name="aa" value="84506" onClick="putGoodValue(106)"  checked>
                  好</td>
                <td width="41" align="center"> 
                  <input type="checkbox" name="bb" value="84506" onClick="putBadValue(106)" >
                  差</td>
              </tr>
              <tr bgcolor="eeeeee"> 
                <td align="center" bgcolor="eeeeee" width="26"><font color=red>108</font></td>
                <td width="153" bgcolor="eeeeee">公司2</td>
                <td width="55" align="center" bgcolor="eeeeee"> 
                  <input type="checkbox" name="aa" value="84501" onClick="putGoodValue(107)"  checked>
                  好</td>
                <td width="41" align="center"> 
                  <input type="checkbox" name="bb" value="84501" onClick="putBadValue(107)" >
                  差</td>
              </tr>
              <tr bgcolor="eeeeee"> 
                <td align="center" bgcolor="eeeeee" width="26"><font color=red>109</font></td>
                <td width="153" bgcolor="eeeeee">公司3</td>
                <td width="55" align="center" bgcolor="eeeeee"> 
                  <input type="checkbox" name="aa" value="7707" onClick="putGoodValue(108)"  checked>
                  好</td>
                <td width="41" align="center"> 
                  <input type="checkbox" name="bb" value="7707" onClick="putBadValue(108)" >
                  差</td>
              </tr>
              <tr bgcolor="eeeeee"> 
                <td align="center" bgcolor="eeeeee" width="26"><font color=red>110</font></td>
                <td width="153" bgcolor="eeeeee">公司4</td>
                <td width="55" align="center" bgcolor="eeeeee"> 
                  <input type="checkbox" name="aa" value="758" onClick="putGoodValue(109)" >
                  好</td>
                <td width="41" align="center"> 
                  <input type="checkbox" name="bb" value="758" onClick="putBadValue(109)" >
                  差</td>
              </tr>
              <tr bgcolor="eeeeee"> 
                <td align="center" bgcolor="eeeeee" width="26"><font color=red>111</font></td>
                <td width="153" bgcolor="eeeeee">公司5</td>
                <td width="55" align="center" bgcolor="eeeeee"> 
                  <input type="checkbox" name="aa" value="84524" onClick="putGoodValue(110)" >
                  好</td>
                <td width="41" align="center"> 
                  <input type="checkbox" name="bb" value="84524" onClick="putBadValue(110)"  checked>
                  差</td>
              </tr>
              <tr bgcolor="eeeeee"> 
                <td align="center" bgcolor="eeeeee" width="26"><font color=red>112</font></td>
                <td width="153" bgcolor="eeeeee">公司6</td>
                <td width="55" align="center" bgcolor="eeeeee"> 
                  <input type="checkbox" name="aa" value="84300" onClick="putGoodValue(111)" >
                  好</td>
                <td width="41" align="center"> 
                  <input type="checkbox" name="bb" value="84300" onClick="putBadValue(111)"  checked>
                  差</td>
              </tr>
              <tr bgcolor="eeeeee"> 
                <td align="center" bgcolor="eeeeee" width="26"><font color=red>113</font></td>
                <td width="153" bgcolor="eeeeee">公司7</td>
                <td width="55" align="center" bgcolor="eeeeee"> 
                  <input type="checkbox" name="aa" value="84314" onClick="putGoodValue(112)" >
                  好</td>
                <td width="41" align="center"> 
                  <input type="checkbox" name="bb" value="84314" onClick="putBadValue(112)"  checked>
                  差</td>
              </tr>
              <tr > 
                <td width="26" ></td>
                <td width="153"></td>
                <td width="55"> 
                  <input type="hidden" name="aa" value="" >
                </td>
                <td width="41"> 
                  <input type="hidden" name="bb" value="" >
                </td>
              </tr>
              <tr bgcolor="#CCCCCC"> 
                <td valign='bottom' align='center' colspan="4" > 
                  <input type='reset' value='重新选择'  onClick="setInputNull()">
                  <input type='button' value='关闭窗口'  onClick="window.close()">
                </td>
              </tr>
              </tbody> 
            </table>
     </form></body> 
    </html>
      

  2.   

    <input type='reset' value='重新选择'  onClick="setInputNull()">
    --->
    <input type='button' value='重新选择'  onClick="setInputNull()">你去掉选择了然后又reset了当然又选上了