PHP速学视频免费教程(入门到精通)
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
这篇文章主要介绍了angularjs实现的生成随机数与猜数字大小功能,结合完整实例形式分析了angularjs随机数生成与数值判定相关操作技巧,需要的朋友可以参考下
本文实例讲述了AngularJS实现的生成随机数与猜数字大小功能。分享给大家供大家参考,具体如下:
nbsp;html> <meta> <title>www.jb51.net Angular猜数</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></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><h2>请输入一个1-10的整数</h2> <input><button>检查</button><button>重置</button> <p>0">猜大了</p> <p>猜小了</p> <p>猜对了</p> <p>一共猜了<span></span>次</p>
运行效果:
上面是我整理给大家的,希望今后会对大家有帮助。
相关文章:
已抢7204个
抢已抢94855个
抢已抢14826个
抢已抢52068个
抢已抢194763个
抢已抢87280个
抢