<input id="chkSelectedAll" type="checkbox" onclick="chkSelectAll(this)" />全选
<script type="text/javascript"> function chkSelectAll(oCheck) { //获取Table对象 var oTable = document.getElementById("GridView1"); if(oTable) { //获取Table内所有input对象 var oInputs = oTable.getElementsByTagName("input"); //遍历所有Input对象 for(var i=0;i<oInputs.length;i++) { //判断Input的类型是否为"checkbox" if (oInputs[i].type=="checkbox") { oInputs[i].checked = oCheck.checked; } } } } </script>