JavaScript脚本怎样在GridView的模板列中的CheckBox点击后取得当前行的Index?

来源:百度知道 编辑:UC知道 时间:2024/06/07 22:12:14
一定要在前台写JavaScript脚本,不要后台的方法

<script language="javascript" type="text/javascript">
function setCheckBox(frm)
{
var objCheckBoxItem = document.getElementsByTagName("input")
if (frm.GridView_ctl01_chkAll.checked)
{
for (var i = 0; i < objCheckBoxItem.length; i++)
if (objCheckBoxItem[i].type == "checkbox")
objCheckBoxItem[i].checked = true;
}
else
{
for (var i = 0; i < objCheckBoxItem.length; i++)
if (objCheckBoxItem[i].type == "checkbox")
objCheckBoxItem[i].checked = false;
}
}
</script>

document.form1.checkboxname.value?

<asp:TemplateField HeaderText="<input type='checkbox' id='chk' name='chk' onclick='checkJs(this.checked);' />全选" FooterText="全选">
<ItemTemplate>
<input t