Angular表单判断不同显示效果
来源:互联网 发布:python怎么保存文件 编辑:程序博客网 时间:2024/06/05 19:43
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript" src="js/angular.min.js"></script>
<style>
.ip {
border: 1px solid red;
}
</style>
</head>
<body ng-app="MyApp" ng-controller="MyCont">
<select ng-change="sel()" ng-model="xuan">
<option>只有输入框样式变化</option>
<option>显示详细信息</option>
<option>点击时显示效果</option>
</select><br /> 输入密码
<input type="text" ng-model="pwd" class="{{pass}}" /><br /> 重复密码
<input type="text" ng-model="pwd1" class="{{pass}}" /><br />
<button ng-click="cli()">提交</button>
<ul class="ul" ng-hide="hi">
<li ng-repeat="li in xin">{{li}}</li>
</ul>
<script type="text/javascript">
var mo = angular.module("MyApp", []);
mo.controller("MyCont", function($scope) {
$scope.sel = function() {
var aa = $scope.xuan;
$scope.xin = [];
if(aa == "只有输入框样式变化") {
var pwd = $scope.pwd;
var pwd1 = $scope.pwd1;
if(pwd == undefined || pwd1 == undefined) {
$scope.pass = "ip";
}
if(pwd.length <= 6 || pwd1.length <= 6) {
$scope.pass = "ip";
}
if(pwd != pwd1) {
$scope.pass = "ip";
}
} else if(aa == "显示详细信息") {
var pwd = $scope.pwd;
var pwd1 = $scope.pwd1;
$scope.pass = "vp";
if(pwd == undefined || pwd1 == undefined) {
$scope.xin.push("密码不能为空");
}
if(pwd.length <= 6 || pwd1.length <= 6) {
$scope.xin.push("密码长度不能小于六位")
}
if(pwd != pwd1) {
$scope.xin.push("输入两次密码不同")
}
} else if(aa == "点击时显示效果") {
$scope.hi = true;
$scope.pass = "vp";
}
}
$scope.cli = function() {
var pwd = $scope.pwd;
var pwd1 = $scope.pwd1;
$scope.xin = [];
if(pwd == undefined || pwd1 == undefined) {
$scope.xin.push("密码不能为空");
}
if(pwd.length <= 6 || pwd1.length <= 6) {
$scope.xin.push("密码长度不能小于六位")
}
if(pwd != pwd1) {
$scope.xin.push("输入两次密码不同")
}
$scope.hi = false;
}
})
</script>
</body>
</html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript" src="js/angular.min.js"></script>
<style>
.ip {
border: 1px solid red;
}
</style>
</head>
<body ng-app="MyApp" ng-controller="MyCont">
<select ng-change="sel()" ng-model="xuan">
<option>只有输入框样式变化</option>
<option>显示详细信息</option>
<option>点击时显示效果</option>
</select><br /> 输入密码
<input type="text" ng-model="pwd" class="{{pass}}" /><br /> 重复密码
<input type="text" ng-model="pwd1" class="{{pass}}" /><br />
<button ng-click="cli()">提交</button>
<ul class="ul" ng-hide="hi">
<li ng-repeat="li in xin">{{li}}</li>
</ul>
<script type="text/javascript">
var mo = angular.module("MyApp", []);
mo.controller("MyCont", function($scope) {
$scope.sel = function() {
var aa = $scope.xuan;
$scope.xin = [];
if(aa == "只有输入框样式变化") {
var pwd = $scope.pwd;
var pwd1 = $scope.pwd1;
if(pwd == undefined || pwd1 == undefined) {
$scope.pass = "ip";
}
if(pwd.length <= 6 || pwd1.length <= 6) {
$scope.pass = "ip";
}
if(pwd != pwd1) {
$scope.pass = "ip";
}
} else if(aa == "显示详细信息") {
var pwd = $scope.pwd;
var pwd1 = $scope.pwd1;
$scope.pass = "vp";
if(pwd == undefined || pwd1 == undefined) {
$scope.xin.push("密码不能为空");
}
if(pwd.length <= 6 || pwd1.length <= 6) {
$scope.xin.push("密码长度不能小于六位")
}
if(pwd != pwd1) {
$scope.xin.push("输入两次密码不同")
}
} else if(aa == "点击时显示效果") {
$scope.hi = true;
$scope.pass = "vp";
}
}
$scope.cli = function() {
var pwd = $scope.pwd;
var pwd1 = $scope.pwd1;
$scope.xin = [];
if(pwd == undefined || pwd1 == undefined) {
$scope.xin.push("密码不能为空");
}
if(pwd.length <= 6 || pwd1.length <= 6) {
$scope.xin.push("密码长度不能小于六位")
}
if(pwd != pwd1) {
$scope.xin.push("输入两次密码不同")
}
$scope.hi = false;
}
})
</script>
</body>
</html>
阅读全文
0 0
- Angular表单判断不同显示效果
- Angular 表单判断密码
- angular购物车表单判断,
- Ladda 应用提交表单的时候显示loading加载中 包括不同位置,不同效果
- js焦点 显示不同表单
- textwrapping的不同显示效果
- angular表单
- 非常不错的表单显示效果
- IE6,IE7,firefox显示不同效果
- div 的边框显示不同效果
- jquery根据数据显示不同背景图效果
- 设置不同字体的显示效果
- CartView 图片显示不同的效果
- 判断是否支持脚本显示不同操作
- 判断浏览器和语言显示不同内容
- wordpress判断不同页面显示不同内容的方法
- angular表单认证大全&angular表单控件
- angular表单验证
- Git删除远程仓库文件
- 使用ajax 提交多个form表单以及其他参数
- 过滤器
- 秒杀多线程第五篇 经典线程同步 关键段CS
- 消息队列MQ的使用场景
- Angular表单判断不同显示效果
- Android异步的学习-RxJava
- Java compiler level does not match 问题
- 跟我一起hadoop的(1)-hadoop2.6安装与使用
- hibernate 基本的CRUD增删改查方法
- RocketMQ 问题整理
- 一道暴力,用数学方法优化
- XGBOOST调参
- 35岁 跨进程序员的行列