这是网格视图:
<ItemTemplate>
<asp:TextBox ID="txtAction" Text='<%# Bind("ch_flcode") %>' runat="server"
Width="60%" Columns="50" OnChange="javascript:HandlerCodeTextChange1(this);" AutoPostBack="true"> </asp:TextBox>
<asp:HiddenField ID="hidempCode1" runat="server" />
<asp:HiddenField ID="hidempName1" runat="server" />
</ItemTemplate>
我想在 javascript 中使用 hiddenfields 值
Javascript代码:
function HandlerCodeTextChange1(txtBox1) {
var gv = document.getElementById("<%=gridSIupdate.ClientID%>");
//var Rows = gv.getElementsByTagName("tr");
if (txtBox1.value.indexOf(':') == "-1") {
txtBox1.value = "";
txtBox1.focus();
gv.getElementById('<%=hidempCode1.ClientID%>').value = "";
gv.getElementById('<%=hidempName1.ClientID%>').value = "";
}
else {
var code = txtBox1.value.split(':');
gv.getElementById('<%=hidempCode1.ClientID%>').value = code[0];
gv.getElementById('<%=hidempName1.ClientID%>').value = code[1];
}
}
如何使用javascript获取隐藏字段值?