angularjs 弹框
来源:互联网 发布:黑暗之魂3优化 编辑:程序博客网 时间:2024/05/22 13:01
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <style> div{ width: 500px; height:350px; border: 1px solid #000; } .a{ margin-left: 150px; } .b{ margin-left: 250px; } li{ list-style:none; } body{ background-color: #D0EEFF; background-size:100%; } input{ padding: 4px 10px; height: 20px; line-height: 20px; position: relative; cursor: pointer; color: #888; background: #fafafa; border: 1px solid #ddd; border-radius: 4px; overflow: hidden; display: inline-block; *display: inline; *zoom: 1 } button{ position: relative; display: inline-block; background: #D0EEFF; border: 1px solid #99D3F5; border-radius: 4px; padding: 4px 12px; overflow: hidden; color: #1E88C7; text-decoration: none; text-indent: 0; line-height: 20px; } </style> <script src="http://cdn.bootcss.com/angular.js/1.4.6/angular.min.js"></script> <script> var myapp=angular.module("myapp",[]); myapp.controller("myCtrl",function ($scope) { //设置数组 $scope.data=["早上花了5元钱吃早饭","中午花了20元钱吃午饭"]; //点击记录判断 $scope.start=""; $scope.add=function () { //$scope.start="123"; // alert($scope.start); if($scope.start==""){ alert("输入内容不能为空"); } for(var i=0;i<$scope.data.length;i++){ if($scope.start==$scope.data[i]){ alert("您记录的内容已经在") } } //输入内容敏感字符判断 if($scope.start.indexOf("#")!=-1||$scope.start.indexOf("$")!=-1||$scope.start.indexOf("%")!=-1||$scope.start.indexOf("^")!=-1||$scope.start.indexOf("&")!=-1||$scope.start.indexOf("*")!=-1){ alert("有敏感字符,请重新输入"); }else{ $scope.data.unshift($scope.start); } } //点击查询判断 $scope.end=""; $scope.selete=function () { if($scope.end==""){ alert("输入内容不能为空"); } if($scope.end.indexOf("#")!=-1||$scope.end.indexOf("$")!=-1||$scope.end.indexOf("%")!=-1||$scope.end.indexOf("^")!=-1||$scope.end.indexOf("&")!=-1||$scope.end.indexOf("*")!=-1){ alert("有敏感字符,请重新输入"); }else{ //搜索的判断 for(var i=0;i<$scope.data.length;i++){ if($scope.end==$scope.data[i]){ alert("搜索到相关内容") break; }else{ alert("未搜到相关内容") break; } } } } }) </script></head><body ng-app="myapp" ng-controller="myCtrl"><p>记账本</p><div> <ul ng-repeat="item in data"> <li>{{item}}</li> </ul></div><span class="a">输入框</span><input type="text" ng-model="start"><br><button class="b" ng-click="add()">记录</button><br><span class="a">搜索框</span><input type="text" ng-model="end"><br><button class="b" ng-click="selete()">搜索</button></body></html>
阅读全文
0 0
- angularjs 弹框
- angularjs 弹框
- AngularJS
- angularjs
- Angularjs
- angularJS
- AngularJS
- AngularJS
- AngularJS
- AngularJs
- AngularJS
- AngularJs
- AngularJs
- AngularJS
- AngularJS
- AngularJS
- AngularJS
- AngularJS
- 利用 HashSet不重复特性返回素组中重复元素
- react map遍历
- 【spring】关于location路径的设置(相对路径和绝对路径)
- 你应该要掌握的7种回归分析方法
- Redis笔记(一)Redis简介
- angularjs 弹框
- Linux 静态库 动态库 分析
- 【bzoj2565】最长双回文串
- 03 IO口的分析与使用
- python 几个特别点
- 正则化
- Android使用Gradle命令动态传参完成打包不需要修改代码
- 阻止在div上滚动滚动条,到底部和顶部带动整个页面的滚动条
- Eclipse 安装反编译插件jadclipse(经验总结)