我有一个问题,我有一个应用程序,用户必须尽可能少地使用鼠标,所以他们将只使用键盘插入条目。为此,我使用的是模态弹出窗口,每次用户按输入时,模态都已准备好进入下一个条目。但为此,第一个模式文本框在每个回车键之后聚焦是必要的。我在实现这一点方面遇到了问题...我的代码:一个按钮只需调用模态:<asp:Button ID="btnLotIng_Lotear" runat="server" Text="Crear Lotes" class="btn btn-primary btn-block mb-3" OnClick="Crear_Lotes" OnClientClick="focusear()" />面板:<asp:LinkButton ID="lnkFake_LotIng" runat="server"></asp:LinkButton><asp:Panel ID="pnl_LotIng" runat="server" CssClass="modalPopup" Style="display: none;"> <div style="overflow-y: auto; overflow-x: hidden; max-height: 750px; max-width: 1100px"> <div class="modal-body"> <table class="table table-sm table-hover"> <tbody> <tr> <th scope="row">Lote Numero</th> <td colspan="3"> <asp:TextBox ID="txtLogIng_LotNum" runat="server" CssClass="form-control inputfield text-uppercase" Font-Size="Large" Font-Bold="true" onkeydown="LotNKey(event)"></asp:TextBox> </td> </tr> <tr> <th scope="row">Id1Desde</th> <td> <asp:TextBox ID="txtLogIng_Id1Des" runat="server" CssClass="form-control inputfield text-uppercase" Font-Size="Small" onkeydown="id1DKey(event)"></asp:TextBox> </td> <th scope="row">Id1Hasta</th> <td> <asp:TextBox ID="txtLogIng_Id1Has" runat="server" CssClass="form-control inputfield text-uppercase" Font-Size="Small" onkeydown="id1HKey(event)"></asp:TextBox> </td> </tr> <!-- here go other rows with textboxes --> </tbody>
2 回答

守着一只汪
TA贡献1872条经验 获得超3个赞
我使用jq找到了一个解决方案:
<!-- jq + js para que con c/enter se ubique el focus en el 1er Textbox -->
<script type="text/javascript">
$(document).ready(function () {
console.log('Aqui estoy'); // just checking
document.getElementById('<%=txtLogIng_Id1Des.ClientID%>').focus();
});
</script>
添加回答
举报
0/150
提交
取消