每日一练--抽奖
来源:互联网 发布:递推算法求韩信点兵 编辑:程序博客网 时间:2024/06/03 00:33
抽奖界面的的制作
用到的知识点:
一、Math.random()取得介于 0 到 1 之间的一个随机数
二、1.直接丢弃小数部分,保留整数部分
a:parseInt(1.5555)
b: 0|1.5555
2.向上取整
a: Math.ceil(1.5555)
b: (1.5555+0.5).toFixed(0)
c: Math.round(1.5555+0.5)
3.向下取整
a: Math.floor(1.5555)
b: (1.5555-0.5).toFixed(0)
c:Math.round(1.5555-0.5)
4.四舍五入.
b:1.5555.toFixed(0)
c:Math.round(1.5555)
三、setTimeout() 只执行 code 一次。如果要多次调用,请使用 setInterval() 或者让 code 自身再次调用 setTimeout()
四、键盘事件
var flag=0;document.onkeyup=function(event){ event = event || window.event; if(event.keyCode==13){ if(flag==0){ startFun(); flag=1; }else{ stopFun(); flag=0; } } }
0 0
- 每日一练--抽奖
- 算法每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 【Linux基础】Linux/Windows下安装python、Numpy、Matplotlib
- 【集合框架】3. Map容器
- Android Framework学习——如何加入并编译自定义的模块
- java多线程-04-线程池
- 019 Remove Nth Node From End of List
- 每日一练--抽奖
- android系统级别硬件访问服务程序
- 二叉树的高度 java 利用递归和层次遍历两种方法
- 【集合框架】4. Set容器
- 一元多项式的加减
- mysql 常用命令
- Linux网络编程---I/O复用模型之poll
- 【集合框架】5. Collections类
- android 开发 -- NavigationView和DrawerLayout实现 侧滑栏(Material Design)