zoukankan      html  css  js  c++  java
  • JS点击事件:简单的客户端校验

    <html>
      <head>
        <title>点击事件</title>
        <meta http-equiv="content-type" 
        content="text/html; charset=UTF-8">
        <script type="text/javascript">
            function toSubmit(){
                var username=document.getElementById
                ("username").value;
    
                if(username==""){//客户端JS验证
                    alert("请输入用户名");
                    return;
                }
                document.getElementById("info").submit();   
            }
        </script>
      </head>
      <body>
        <form action="http://www.baidu.com" id="info" >
            用户名:<input  type="text" value="" id ="username"/>
                  <input type="button" value="提交" 
                  onclick="toSubmit()"/>
        </form>
    
      </body>
    </html>
    
    很多事情即将开始,很多人的命运即将改变
  • 相关阅读:
    补码原理
    清风徐来,水波不兴
    月尾和周尾
    又一春又一季
    9.11
    晨光无限
    9.18
    心悠
    小事一桩
    一周岁啦
  • 原文地址:https://www.cnblogs.com/liuzk/p/12458957.html
Copyright © 2011-2022 走看看