亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

ASP,在 Enter 之后聚焦文本框

ASP,在 Enter 之后聚焦文本框

aluckdog 2022-08-18 15:58:28
我有一個問題,我有一個應用程序,用戶必須盡可能少地使用鼠標,所以他們將只使用鍵盤插入條目。為此,我使用的是模態彈出窗口,每次用戶按輸入時,模態都已準備好進入下一個條目。但為此,第一個模式文本框在每個回車鍵之后聚焦是必要的。我在實現這一點方面遇到了問題...我的代碼:一個按鈕只需調用模態:<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貢獻1852條經驗 獲得超1個贊

不要只是 ,試試這個:.Focus

Form.DefaultFocus = txtLogIng_Id1Des.UniqueID;


查看完整回答
反對 回復 2022-08-18
?
守著一只汪

TA貢獻1872條經驗 獲得超4個贊

我使用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>


查看完整回答
反對 回復 2022-08-18
  • 2 回答
  • 0 關注
  • 100 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號