window.onload = function () {
document.getElementById("selectAll").onclick = function () {
var cds = document.getElementsByName("cd");
for (var i = 0; i < cds.length; i++) {
cds.checked = true;
}
};
<tr>
<th><input type="checkbox" name="cb" id="firstCb"></th>
<th>编号</th>
<th>姓名</th>
<th>性别</th>
<th>操作</th>
</tr>