记事本输入框
来源:互联网 发布:下或官方手机淘宝 编辑:程序博客网 时间:2024/06/07 03:27
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="../AngularJS/angular.js" ></script>
<script>
var haha = 3;
var app = angular.module("myApp",[]);
//自定义过滤器
app.filter("myFilter",function(){
return function(text){
//alert("fasd");
if(text.indexOf("敏感字符")>=0){
//alert("asdfasdf");
alert("包含敏感字符")
return text.replace(/敏感字符/g,"***");
}
return text;
}
});
app.controller("myCtrl",function($scope){
$scope.newRecord = "";
$scope.selectRecord = "";
$scope.records = ["早上花了5块钱吃早饭","中午花了20块钱吃早饭"];
$scope.addRecord = function(){
if($scope.newRecord == "" || $scope.newRecord == null){
alert("输入内容为空");
}else{
$scope.records.unshift($scope.newRecord);
alert($scope.records[2]);
}
};
var flag = true;
$scope.selectRecordMethod = function(){
for(record in $scope.records){
if($scope.records[record] == $scope.selectRecord){
alert("已经存在");
flag = false;
}
}
if(flag){
alert("不存在");
}
}
/*$scope.myFilter = function(text){
var reg = /敏感字符/;
if(reg.test(text)){
return text.replace(/敏感字符/g,"***");
}
}*/
});
</script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<center>
记事本
<div style="width: 300px; height: 250px; border: 1 solid blue; background-color:#A6E1EC;">
<p ng-repeat="record in records ">{{record | myFilter }}</p>
</div><br/>
输入框:<input type="text" ng-model="newRecord" /><br/>
<button ng-click="addRecord()">记录</button><br/>
搜索:<input type="text" ng-model="selectRecord" /><br/>
<button ng-click="selectRecordMethod()">记录</button>
</center>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="../AngularJS/angular.js" ></script>
<script>
var haha = 3;
var app = angular.module("myApp",[]);
//自定义过滤器
app.filter("myFilter",function(){
return function(text){
//alert("fasd");
if(text.indexOf("敏感字符")>=0){
//alert("asdfasdf");
alert("包含敏感字符")
return text.replace(/敏感字符/g,"***");
}
return text;
}
});
app.controller("myCtrl",function($scope){
$scope.newRecord = "";
$scope.selectRecord = "";
$scope.records = ["早上花了5块钱吃早饭","中午花了20块钱吃早饭"];
$scope.addRecord = function(){
if($scope.newRecord == "" || $scope.newRecord == null){
alert("输入内容为空");
}else{
$scope.records.unshift($scope.newRecord);
alert($scope.records[2]);
}
};
var flag = true;
$scope.selectRecordMethod = function(){
for(record in $scope.records){
if($scope.records[record] == $scope.selectRecord){
alert("已经存在");
flag = false;
}
}
if(flag){
alert("不存在");
}
}
/*$scope.myFilter = function(text){
var reg = /敏感字符/;
if(reg.test(text)){
return text.replace(/敏感字符/g,"***");
}
}*/
});
</script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<center>
记事本
<div style="width: 300px; height: 250px; border: 1 solid blue; background-color:#A6E1EC;">
<p ng-repeat="record in records ">{{record | myFilter }}</p>
</div><br/>
输入框:<input type="text" ng-model="newRecord" /><br/>
<button ng-click="addRecord()">记录</button><br/>
搜索:<input type="text" ng-model="selectRecord" /><br/>
<button ng-click="selectRecordMethod()">记录</button>
</center>
</body>
</html>
阅读全文
1 0
- 记事本输入框
- 记事本输入当前时间
- 文章标题 AngularJs记事本 简单实现(判断输入框以及查找)
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 网络判断
- TCP通信
- 第二章 java语言基础
- 安哥拉练习题
- AutoML-自动机器学习
- 记事本输入框
- 操作系统复习总结
- java中的常见的数据类型(四类八种)
- GPS,UTC和本地时间的显示器
- 【练习】顺序串的实现及应用
- python---实战5筛选特定数据的长度、最多(字典、元组、列表、文件操作、替换)
- 实验:centos7.3实现基于源码编译安装LAMP的wordpress应用
- Java的四种引用,强弱软虚,用到的场景
- battery-historian V2.0的数据获取及参数分析