angularjs+生成随机数猜数字大小
来源:互联网 发布:淘宝联盟手机版官网 编辑:程序博客网 时间:2024/06/16 18:58
生成随机数猜数字大小
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <style> *{ margin: 0; padding: 0; font-size: 30px; } input{ width: 500px; height: 50px; font-size: 30px; } button{ width: 80px; height: 50px; border: 0; text-align: center; line-height: 50px; background: darkblue; color: #fff; margin-left: 5px; } </style> <script src="angular/angular.js"></script> <script> var myapp=angular.module("myapp",[]); myapp.controller("myCtrl",function ($scope) { $scope.check=function () { console.log($scope.random); $scope.differ=$scope.guess-$scope.random; $scope.num++; }; $scope.reset=function () { $scope.differ=null; $scope.guess=null; $scope.num=0; $scope.random=Math.ceil(Math.random()*10); }; $scope.reset(); }) </script></head><body ng-app="myapp" ng-controller="myCtrl"><h2>请输入一个1-10的整数</h2><input type="text" ng-model="guess"><button ng-click="check()">检查</button><button ng-click="reset()">重置</button><p ng-if="differ>0">猜大了</p><p ng-if="differ<0">猜小了</p><p ng-if="differ==0">猜对了</p><p>一共猜了<span ng-bind="num"></span>次</p></body></html>
阅读全文
0 0
- angularjs+生成随机数猜数字大小
- angularjs+生成随机数猜数字大小
- angularjs+生成随机数猜数字大小
- 生成随机数,数字排序
- java 生成字母+数字随机数
- js生成随机数(数字+字母)
- 根据随机数猜大小
- angularjs 猜大小
- AngularJS猜大小
- angularjs 猜大小
- angularjs猜数字游戏
- 生成英文和数字的随机数
- asp.net生成数字、字母随机数
- 生成四位随机数,数字不重复
- c#生成随机数(数字和字母)
- 生成大小写字母+数字的随机数
- 生成6位数字组合的随机数
- java生成范围内的纯数字随机数
- Glide 判断图片是否存在 以及获得宽高
- java入门篇
- Dev c++调试时停止工作解决方法
- 抓firefox上https请求
- Lua_协同程序_011
- angularjs+生成随机数猜数字大小
- C++连接Mysql数据库 & 使用预处理读写BLOB
- 自己实现的qgraphicsitem
- [tensorflow image ops]Image解码函数
- jquery常用选择器总结
- Httpservlet cannot be resolved to a type的原因与解决方法
- spring boot 下多环境配置占位符无法使用
- Vue环境搭建
- day8--socketserver回顾