zoukankan      html  css  js  c++  java
  • 按回车提交问题:

    按回车提交问题:

    aspx页面有文本框和按钮:
    文本框:TextBox_InputNum
    搜索按钮:Button_DataSearch


    要实现的功能是:在文本框输入数据以后,按回车提交(也就是说,按回车可以搜索,按搜索按钮也可以搜索)

    步骤:1)、用js写个函数:
               

    <script type="text/javascript" language="javascript">
               
    function KeyDown()
               
    {
                 
    if (event.keyCode == 13)
                 
    {
                    event.returnValue
    =false;
                    event.cancel 
    = true;
                    form_Search.Button_DataSearch.click();
    //使用表单提交
                 }

               }

               
    </script>

     

            2)、在文本框(TextBox_InputNum)上添加onkeydown或者onkeypress事件,如:onkeydown="KeyDown()"
                

     <asp:TextBox ID="TextBox_InputNum" runat="server" Width="80px"  AutoPostBack="false" onkeydown="KeyDown()" ></asp:TextBox>
    Fighting
  • 相关阅读:
    ZOJ 3818 Pretty Poem
    HDU 4597 Play Game
    HDU 4497 GCD and LCM
    CSU 1335 高桥和低桥
    UVA 10791 Minimum Sum LCM
    CSU 1119 Collecting Coins
    CSU 1120 病毒
    UVA 12169 Disgruntled Judge
    HDU 1301 Jungle Roads
    POJ 1258 Agri-Net
  • 原文地址:https://www.cnblogs.com/cry/p/618153.html
Copyright © 2011-2022 走看看