js 实现复选框全选的代码

<script language="javascript" type="text/javascript">
        function selectAll(obj)
        {
            var theTable =

obj.parentElement.parentElement.parentElement;
            var i ;
            var j = obj.parentElement.cellIndex;
            for(i =0 ; i<theTable.rows.length;i++)
            {
                var objCheckBox = theTable.rows[i].cells

[j].firstChild;
                if(objCheckBox != null)
                {
                    objCheckBox.checked = obj.checked;
                }
            }
        }
    </script>

posted @ 2010-06-23 17:08  JasonNET  阅读(211)  评论(0编辑  收藏  举报