在我的页面上我有一些JS代码。它仅适用于IE。不适用于Firefox和谷歌浏览器。
当Datagrid的checkox onclick函数时,JS函数会触发..
<asp:TemplateColumn Visible="true">
<ItemTemplate>
<asp:CheckBox ID="chkSelect" Runat="server" onclick="kontrol(this);"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
这是JS代码..
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<script type="text/javascript">
var secilenler = "";
var birim = "";
function kontrol(obj) {
var sira = parseInt(obj.id.substring(obj.id.length - 1, obj.id.length)) + 1;
var grid = document.getElementById("<%= grdIslemler.ClientID %>");
if (secilenler == "") {
secilenler += obj.id + "|";
birim = grid.rows(sira).cells(1).innerHTML;
}
else {
if (birim == grid.rows(sira).cells(1).innerHTML) {
secilenler += obj.id + "|";
}
else {
secilenler = secilenler.substring(0, secilenler.length - 1);
var arr = new Array();
arr = secilenler.split("|");
for (var i = 0; i < arr.length; i++) {
var chk = document.getElementById(arr[i]);
chk.checked = false;
secilenler = obj.id + "|";
birim = grid.rows(sira).cells(1).innerHTML;
}
}
}
}
</script>