zoukankan      html  css  js  c++  java
  • 实现对数据的校验并提示

     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2 <html xmlns="http://www.w3.org/1999/xhtml">
     3 <head>
     4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     5 <title>无标题文档</title>
     6 </head>
     7 
     8 <body>
     9 <div align="center">
    10     <table>
    11         <tr>
    12             <td>用户名:</td><td><input onfocus="ffocus()" onblur="bblur(this)" type="text" id="uerName"/></td><td id="mess" ></td>
    13         </tr>
    14     
    15     </table>
    16 
    17 </div>
    18 </body>
    19 <script>
    20     function ffocus(){
    21         document.getElementById("mess").innerHTML="用户名必须是3-6个字符";
    22     
    23     }
    24     function bblur(t){
    25         var userName=t.value;
    26         alert(userName.length);
    27         if(userName.length>=3&&userName.length<=6){
    28             document.getElementById("mess").innerHTML="<img width='100px' height='50px' src='正确.png' >";
    29         
    30         }else{
    31             document.getElementById("mess").innerHTML="<img width='100px' height='50px' src='错误.png' >";
    32         
    33         }
    34         
    35     }
    36 </script>
    37 </html>
  • 相关阅读:
    tomcat部署https
    Java程序内存的简单分析
    接口设计原则
    英语常用口语
    洛谷 P3956 棋盘
    洛谷 P1101 单词方阵
    二分查找模板(准确找定值)
    洛谷 P1892 [BOI2003]团伙
    浅谈二分的边界问题
    deque简单解析
  • 原文地址:https://www.cnblogs.com/lyxcode/p/7707856.html
Copyright © 2011-2022 走看看