zoukankan      html  css  js  c++  java
  • 页面回车键响应,onkeydown事件

    页面中响应回车键代码:
    JS:
     1function enterSubmit(src,e)
     2     {
     3        if(window.event)
     4            keyPressed = window.event.keyCode; // IE
     5        else
     6            keyPressed = e.which; // Firefox
     7        if(keyPressed==13)
     8        
     9            submitForm();            
    10           return false;
    11        }

    12    }

    13    function submitForm()
    14    {
    15        var obj = document.getElementById('MyMaster_DemoPageInput_goButton');                      
    16        obj.click();                 
    17    }
    HTML:
    <asp:TextBox ID="keyinput"onkeydown="return enterSubmit(this,event);" runat="server"></asp:TextBox>

  • 相关阅读:
    一套权威的 MQTT Client 库
    tcp编程 示例
    我的座右铭
    win7改装 CentOS7,装完后开机,没有引导
    程序员16个建议
    Linux
    Linux
    socket
    关于RESTFUL的理解
    Django Rest Framework
  • 原文地址:https://www.cnblogs.com/luyinghuai/p/1224066.html
Copyright © 2011-2022 走看看