你的意思是这样的么?我做测试已经通过.....<html><head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>New Page 1</title>
</head><body><form method="POST" name="f1" action="--WEBBOT-SELF--">
  <!--webbot bot="SaveResults" u-file="file:///F:/Documents and Settings/Administrator/My Documents/My Webs/_private/form_results.csv" s-format="TEXT/CSV" s-label-fields="TRUE" --><p>
  <input type="checkbox" name="C1" value="ON" onclick="setdetail(this)"><input type="button" value="Button" name="B1" ><input type="reset" value="Reset" name="B2"></p>
</form>
<script>function setdetail(checkname)
{
if(checkname.checked ==true)
alert(checkname.name);
}
</script>
</body></html>

解决方案 »

  1.   

    你应该先确认checkname是否为字符串,要是为字符串,那你的写法肯定是错的。要是为对象那就更不对了。
    再说checked本身就是布尔值,所以直接。
    if (document.all.checkBoxName.checked)
      {... }
    else
      {... }
    要是你想传入的是字符串,
    tempObject=eval("document.all."+checkname)
    if (tempObject)
       if (tempObject.checked)
      {... }
    else
      {... }
    看懂了吗,别忘了给分。
      

  2.   

    <script>
    function setdetail(checkname)
    {
    if(adform.elements["checkname"].checked ==true)
    alert(checkname);
    }
    </script>