密码框内容的各种展示情况
2017-10-24 18:48
183 查看
密码框使我们生活中常见到的情况,这个博客就是设置一个简单的模板进行调用,方便我们以后的工作,新手上路,不喜勿喷。
源代码如下:
<!DOCTYPE html> <html ng-app="myApp"> <head lang="en"> <meta charset="UTF-8"> <title>密码框的内容校验</title> <script type="text/javascript" src="angular-1.3.0.js"></script> <script type="text/javascript" src="angular-route.js" ></script> <script type="text/javascript" src="jquery.1.12.4.js"></script> <style type="text/css"> #button{ background: green; color: aliceblue; width: 60px; height: 40px; font-size: 16px; } #div1{ width: 300px; height: 100px; margin: auto; } </style> <script type="text/javascript"> var app = angular.module("myApp",[]); app.controller("myCtrl",function($scope){ $scope.erro_show = false; $scope.l1 = false; $scope.l2 = false; $scope.l3 = false; var button = document.getElementById("button"); button.disabled=true; $scope.select = function(){ if($scope.style_value==1){ button.disabled=true; $scope.my_style ={ "border":"1px solid red" } }else if($scope.style_value==2){ button.disabled=true; $scope.my_style ={ "border":"1px solid black" } $scope.erro_show = true; $scope.l1 = true; $scope.l2 = true; $scope.l3 = true; }else if($scope.style_value==3){ button.disabled=false; $scope.my_style ={ "border":"1px solid black" } $scope.erro_show = false; $scope.l1 = false; $scope.l2 = false; $scope.l3 = false; $scope.sub = function(){ var psw = $scope.psw; var psw1 = $scope.psw1; if(psw!=null&&psw1!=null){ if(psw.length>=6&&psw1.length>=6){ if(psw==psw1){ $("input").css({"border":"1px solid black"}); $scope.erro_show = false; alert("提交成功"); $scope.psw=""; $scope.psw1=""; }else{ $scope.erro_show = true; $scope.l3 = true; $("input").css({"border":"1px solid red"}); } }else{ $scope.erro_show = true; $scope.l1 = true; $("input").css({"border":"1px solid red"}); } }else{ $scope.erro_show = true; $scope.l2 = true; $("input").css({"border":"1px solid red"}); } } } } }); </script> </head> <body ng-controller="myCtrl"> <div id="div1"> 密码:<input type="password" placeholder="6-20个字符" ng-model="psw" ng-style="my_style"><br> 重复密码:<input type="password" placeholder="再次输入密码" ng-model="psw1" ng-style="my_style"><br> <div ng-show="erro_show" style="width: 300px;height: 100px;background: lightpink"> <ul style="color: lightcoral"> <li ng-show="l1">密码长度不能小于6个字符</li> <li ng-show="l2">密码不能为空</li> <li ng-show="l3">两次密码输入不一致</li> </ul> </div> <input type="button" value="提交" ng-click="sub()" id="button"> </div> <div id="div2"> <p>显示方式</p> <select ng-model="style_value" ng-change="select()"> <option value="">显示方式</option> <option value="1">只有输入框样式变化</option> <option value="2">显示错误提示</option> <option value="3">点击提交才显示错误提示</option> </select> </div> </body> </html>
相关文章推荐
- AngularJs实现密码框的内容校验,并实现下拉列表的所列的展示形式
- 使iframe随内容(target到iframe的内容)改变而自适应高度,完美解决各种获取第一个demo高度后第二个高度不变情况
- 各种链接 (没有办法,没有积分,只能以这种情况展示)
- 实现密码框的内容校验,并实现下拉列表的所列的展示形式
- 【c++】深入剖析虚拟继承与各种继承关系中派生类内成员内存分布情况及虚基类表的内容
- 内容页面的各种情况!
- IOS中设置UINavigationBar的各种样式(图片/透明效果/下方内容显示情况)
- IOS中设置UINavigationBar的各种样式(图片/透明效果/下方内容显示情况)
- Oracle各种情况下修改密码
- UILineBreakMode的各种情况
- ElasticSearch实战:个人博客搜索和首页内容展示
- 在密码过期的情况下,使用Web页面更改密码-by iLync
- download..仔细分析各种情况
- Add Two Numbers 看着简单,其实各种奇葩情况需要考虑。。。
- js统计字符串中各种字符情况
- 在火狐和chrome不同的自动填充密码机制下实现根据密码框是否有内容来添加不同类的功能
- DropdownList内容树状展示 字段前空格不显示
- 这个开源项目展示了如何实现一个横跨各种Android平台的音乐播放器,包括手机,平板,汽车,手表,电视等。Google官方推出,跨平台开发必看项目。
- Centos7 忘记密码的情况下,修改root或其他用户密码
- 各种stream相关内容