<script>
var user = document.getElementById("user");
var pwd = document.getElementById("pwd");
var user_erro = document.getElementById("user_erro");
var pwd_erro = document.getElementById("pwd_erro");
//focus 获得焦点
user.addEventListener("blur", function () {
check_length(user); //传递参数
}, false);
pwd.addEventListener("blur", function () {
check_length(pwd);
}, false); function check_length(obj) {
var that = obj;
if (that.value.length < 1) {
that.style.borderColor = 'rgb(255, 76, 82)'; //为空
show_dom(that.id,"block");
} else {
that.style.borderColor = 'rgb(17, 194, 109)'; //不为空
show_dom(that.id,"none");
}
}
function show_dom(obj,disp) {
switch (obj) {
case "user":
user_erro.style.display = disp;
break;
case "pwd":
pwd_erro.style.display = disp;
break;
}
} </script>

最新文章

  1. Android编程思想双11口诀
  2. sqlserverJDBC驱动链接
  3. 使用zookeeper实现分布式锁
  4. HDU 4749 Parade Show(贪心+kmp)
  5. 小白学习mysql之函数
  6. linux 强大的编辑器之vi
  7. Windows之vmware安装破解版错误汇总
  8. linux配置Java(JDK)环境变量
  9. ubuntu编译openwrt前端web界面
  10. TOGAF架构开发方法(ADM)之需求管理阶段
  11. SpringMVC中的@Controller和@RequestMapping到底什么鬼?
  12. Python可视化库Matplotlib的使用
  13. codeforces 796A-D
  14. centos7 jmeter分布式安装
  15. jQuery-全屏滚动插件【fullPage.js】API 使用方法总结
  16. Web Workers文档
  17. 设置Linux终端字体颜色
  18. 雷林鹏分享:Ruby 发送邮件 - SMATP
  19. [转载]Android中Bitmap和Drawable
  20. 求子数组的最大和要求O(n)

热门文章

  1. 灾备系统 RTO与RPO
  2. STL stack 常见用法详解
  3. java进程CPU高分析
  4. mac手册汉化 2019
  5. C#中判断文件夹或文件是否存在的方法
  6. C#.net开发 List与DataTable相互转换
  7. js gridview中checkbox的全选与全不选
  8. wpf 模板绑定父对象
  9. 解决centos-yum无法正常使用问题
  10. Vue学习笔记(一) 利用idea 搭建 vue 项目