angular猜1-10的随机数
来源:互联网 发布:2016年6月我国域名总数 编辑:程序博客网 时间:2024/06/05 05:05
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> * { margin: 0; padding: 0; font-size: 30px; } input { width: 400px; height: 40px; font-size: 30px; } button { width: 80px; height: 50px; border: 0; text-align: center; line-height: 50px; background: darkblue; color: #fff; margin-left: 5px; } .check{ background-color: #aaf; } .reset{ background-color: #afa; } div{ width: 500px; height: 50px; background-color: #aaa; } </style> <script src="js/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"> <center> <h2>猜数游戏</h2> <div>猜一猜,多大值?(1-10)</div><br/> <input type="number" ng-model="guess"> <button ng-click="check()" class="check">检查</button> <button ng-click="reset()" class="reset">重玩一次</button><br/><br/> <p ng-if="differ>0">猜大了</p> <p ng-if="differ<0">猜小了</p> <p ng-if="differ==0">猜对了</p> <p>一共猜了<spanng-bind="num"></span>次</p> </center> </body> </html>
阅读全文
0 0
- angular猜1-10的随机数
- Angular + Node 生成 随机数
- 生成1-10的随机数
- #随机数#产生1~n之间的随机数
- 1-100的随机数
- angular取随机数--摇色子demo
- angular js的学习(1)
- ANGULAR 1与 ANGULAR 2之间的一些差别
- 利用1~7的随机数,产生一个1~10的随机数
- 编写一个程序,获取10个1至20的随机数,要求随机数不能重复。
- 编写一个程序,获取10个1至20的随机数,要求随机数不能重复。
- Java编写一个程序,获取10个1~20的随机数.要求随机数不能重复.
- 集合框架_产生10个1-20之间的随机数要求随机数不能重复案例
- 编写一个程序,获取10个1-20的随机数,要求随机数不能重复
- 使用HashSet存储10个1-20之间的随机数,并且要求随机数不重复。
- 集合框架-产生10个1-20之间的随机数,要求随机数不能重复
- 集合框架(产生10个1-20之间的随机数要求随机数不能重复)
- 随机数的猜数字游戏
- rocketmq入门学习笔记
- java鬼混笔记:springboot 4、springboot热部署
- 让用VS2012/VS2013编写的程序在XP中顺利运行
- HDOJ2057(十六进制加法)
- UE4物理模块分析
- angular猜1-10的随机数
- 新手第一天发布数据结构欢迎大佬指导
- Okhttp之上传头像和封装类
- Linux档案与目录--鸟哥私房菜读书笔记
- python os.stat() 和 stat模块详解
- Android布局之RecyclerView初级入门介绍及相关教程
- HDU 1058 Humble Numbers
- 发送通知+违规字符
- 将图片的BitMap类转化为File文件