JS问题! 大家来看看!分部不够再加
<asp:CheckBox ID="chk_Income_Flg" Width="40px" runat="server" onclick="chk_ReadOnly(this)" .../>
js方法:
function chk_ReadOnly(obj) {
//行号,列号
var rowIndex, c
o = obj
while (o.tagName != "TD")
o = o.parentNode
if (o.tagName != "TD") return
c = o.cellIndex
while (o.tagName != "TR")
o = o.parentNode
if (o.tagName != "TR") return
rowIndex = o.rowIndex
var Control_chk_Tmp, Control_txt_Tmp;
var doc;
var control_grv;
doc = document.getElementById("<%=grv_CustomerIncomeTbl.ClientID%>");
//取Checkbox
if (doc.rows[rowIndex].cells[6] != undefined) {
if (doc.rows[rowIndex].cells[6].all[1].type == "checkbox") {
//获取控件
control_grv = doc.rows[rowIndex].cells[6].all[1].id;
Control_chk_Tmp = document.getElementById(control_grv);
if (Control_chk_Tmp == null) {
return;
}
}
} else { return; }
//取TextBox
if (doc.rows[rowIndex].cells[7] != undefined) {
if (doc.rows[rowIndex].cells[7].all[0].type == "text") {
//获取控件
control_grv = doc.rows[rowIndex].cells[7].all[0].id;
Control_txt_Tmp = document.getElementById(control_grv);
if (Control_txt_Tmp == null) {
return;
}
}
} else { return; }
//点击的是中转标记
if (c == 6) {
if (Control_chk_Tmp.checked == true) {
Control_txt_Tmp.value ="";
Control_txt_Tmp.disabled = false;
} else {
Control_txt_Tmp.value ="";
Control_txt_Tmp.disabled = true;
}
}
}
必须在CheckBox 的onclick事件里调用· 现在有一问题·
页面首次进来时 他不执行 我要让它执行 改咋办?