zoukankan      html  css  js  c++  java
  • .focus()

    某一组件(部件)获得焦点,简单地说就意味着常规的键盘输入消息会默认地发送给该组件。对于按钮来说,最直接的就是,当其获得焦点后,你按键盘的空格键或回车键(如果回车键消息没有被设置成另外的按钮默认响应),就与用鼠标点击了该按钮是相同的效果。

    function enterSubmit(eveent) {
                if (event.keyCode == 13) {
                    document.getElementById("btn_submit").focus();
                    return false;
                }
            }
            function check() {
                if (document.getElementById("tb_password").value.length == 0) {
                    alert("请输入您的密码!");
                    return false;
                }
                return true;
            }
        
    <body>
    <form method="post" action="/xyzyj/p/6201338.html" onsubmit="return check()">
    <div style="margin-top:50px">
    <div style="300px;margin:0 auto;">
    <div>请输入博文的阅读密码: </div>
    <div><input type="password" id="tb_password" name="tb_password" style="200px" onkeydown="EnterSubmit(event);"></div>
    <div><input type="submit" id="btn_submit" value="确定"></div>
    </div>
    </div>
    </form>
    
    </body>
    ,
  • 相关阅读:
    android开发过程遇到的一些错误
    TCP/IP协议详解笔记——ARP协议和RARP协议
    TCP/IP协议详解笔记——IP协议
    C# Exchange发送邮件
    Echarts柱状图堆叠显示总数
    Git解决fatal: unable to connect to github.com问题
    IIS 413错误 解决方案
    C#启动外部Exe控制台程序并输入命令
    再看JavaScript
    Web Api(5)
  • 原文地址:https://www.cnblogs.com/fpcbk/p/11014788.html
Copyright © 2011-2022 走看看