哦  不能通过id="dlist1_ctl00_dlist2_ctl00_CheckBoxList1_0"和name="dlist1$ctl00$dlist2$ctl00$CheckBoxList1$0"来获取checkbox对象
只能通过<span 来回去<span里面的checkbox对象

解决方案 »

  1.   

    写个偷懒方法,哈注:span 后面必须是 checkbox,否则就要修改js了。
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title> new document </title>
        <meta name="generator" content="editplus" />
        <meta name="author" content="Gao YiXiang" />
        <meta name="email" content="[email protected]" />
        <meta name="keywords" content="javascript dhtml dom" />
        <meta name="description" content="I love web development." />
    </head>
    <body>
        <table>
            <tr>
                <td> <span name="GET_ALL_ACCOUNTS_AGAIN" ckid="CheckBoxList1_"> <input   id="dlist1_ctl00_dlist2_ctl00_CheckBoxList1_0"   type="checkbox"   name="dlist1$ctl00$dlist2$ctl00$CheckBoxList1$0"   /> <label   for="dlist1_ctl00_dlist2_ctl00_CheckBoxList1_0"> 重新统计会员积分 </label> </span> </td> <td> 
            </tr>
        </table>
        <script type="text/javascript">
        <!--
    var spans = document.getElementsByTagName("span");
    for (var i=0; i<spans.length; i++)
    {
        spans[i].firstChild.checked = true;
    }
        //-->
        </script>
    </body>
    </html>
      

  2.   


    <html>
    <head>
    <title> new document </title>
    <script language="javascript">
    function Sel(){
    var obj=document.getElementsByTagName('input');
    for(var i=0;i<obj.length;i++){
    if(obj[i].type="checkbox"){
    obj[i].checked=true;
    }
    }
    }
    </script>
    </head>
    <body>
    <span>
    <input   type="checkbox"   name="table_name"> 
    <input   type="checkbox"   name="table_name"> 
    <input   type="checkbox"  name="table_name"> 
    <input   type="checkbox"   name="table_name"> 
    <INPUT TYPE="button" name="bt1" id="bt1" value="             selectAll            " onclick="Sel()">
    </span>
    </body>
    </html>
      

  3.   

    <script language="javascript" type="text/javascript" charset="utf-8">
    var checkboxs = document.getElementByTagName("input");
    for (var i=0;i<checkboxs.lenght;i++)
    {
    if (checkboxs[i].type.toLowerCase() == "checkbox") {checkboxs[i].checked = true;}

    </script>
      

  4.   

    因为一部分input的信息一定要写在SPAN里面,所以只能通过SPAN获取
      

  5.   

    改一版,L@_@K
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title> new document </title>
        <meta name="generator" content="editplus" />
        <meta name="author" content="Gao YiXiang" />
        <meta name="email" content="[email protected]" />
        <meta name="keywords" content="javascript dhtml dom" />
        <meta name="description" content="I love web development." />
        <style type="text/css">
    span
    {
        border: 1px solid red;
    }
        </style>
    </head>
    <body>
        <input   id="c1"   type="checkbox"   name=""   /> <label   for="c1"> 非 span 滴 重新统计会员积分 </label>
        <table>
            <tr>
                <td> <span name="GET_ALL_ACCOUNTS_AGAIN" ckid="CheckBoxList1_"> <input   id="dlist1_ctl00_dlist2_ctl00_CheckBoxList1_0"   type="checkbox"   name="dlist1$ctl00$dlist2$ctl00$CheckBoxList1$0"   /> <label   for="dlist1_ctl00_dlist2_ctl00_CheckBoxList1_0"> 重新统计会员积分 </label> </span> </td> <td> 
            </tr>
            <tr>
                <td> <span name="GET_ALL_ACCOUNTS_AGAIN" ckid="CheckBoxList1_"> 没有 checkbox 重新统计会员积分 </span> </td> <td> 
            </tr>
            <tr>
                <td> <span name="GET_ALL_ACCOUNTS_AGAIN" ckid="CheckBoxList1_"> <input   id="dlist1_ctl00_dlist2_ctl00_CheckBoxList1_1"   type="checkbox"   name="dlist1$ctl00$dlist2$ctl00$CheckBoxList1$1"   /> <label   for="dlist1_ctl00_dlist2_ctl00_CheckBoxList1_1"> 有 checkbox 重新统计会员积分 </label> </span> </td> <td> 
            </tr>
        </table>
        <input   id="c2"   type="checkbox"   name=""   /> <label   for="c2"> 非 span 滴 重新统计会员积分 </label>
        <script type="text/javascript">
        <!--
    var spans = document.getElementsByTagName("span");var inputs, aInput;for (var i=0; i<spans.length; i++)
    {
        inputs = spans[i].getElementsByTagName("input");    for (var j=0; j<inputs.length; j++)
        {
            aInput = inputs[j];        if (aInput.type.toLowerCase() == "checkbox")
            {
                aInput.checked = true;
            }
        }
    }
        //-->
        </script>
    </body>
    </html>