H5页面定时器
来源:互联网 发布:现在常用的数据库 编辑:程序博客网 时间:2024/06/03 18:51
做活动时,需要的定时器js写法
function checkedTime(){ var startTime = new Date().formatTimestamp('2017-12-25 00:00:00'); var endTime = new Date().formatTimestamp('2018-01-05 23:59:59'); var nowTime = new Date().getTime(); if(nowTime < startTime) { layer.open({ content:'<div style="line-height:1.5;"><p style="color:#fff;font-size:0.6rem;">活动未开始!</p>'+ '<p style="color:#fff;font-size:0.5rem;">活动时间:2017-12-25~2018-12-05</p></div>' }); return false; }else if(nowTime > endTime) { layer.open({ content:'<div style="line-height:1.5;"><p style="color:#fff;font-size:0.6rem;">活动已结束!</p>'+ '<p style="color:#fff;font-size:0.5rem;">活动时间:2017-12-25~2018-12-05</p></div>' }); return false; } return true;}//将字符串时间格式化成13位时间戳Date.prototype.formatTimestamp = function (val) { var f = val.split(' ', 2); var d = (f[0] ? f[0] : '').split('-', 3); var t = (f[1] ? f[1] : '').split(':', 3); return (new Date( parseInt(d[0], 10) || null, (parseInt(d[1], 10) || 1) - 1, parseInt(d[2], 10) || null, parseInt(t[0], 10) || null, parseInt(t[1], 10) || null, parseInt(t[2], 10) || null )).getTime();};
阅读全文
0 0
- H5页面定时器
- H5页面中的定时器(setTimeout)问题
- h5页面
- H5页面
- H5及H5页面是什么意思?如何制作H5页面?
- H5页面测试总结
- H5页面性能优化
- h5页面设计-1
- h5页面-1
- h5页面-2
- 第一个h5页面
- H5页面设计
- H5页面设计
- H5页面设计
- H5页面设计
- H5页面设计
- H5页面设计
- h5页面摇一摇游戏
- Mysql修改密码Warning: single quotes were not trimmed line client, as you might have expected.
- 使用Sublime Text 开发Python如何配置环境(windows 7)
- Tensorflow的GPU配置:ubuntu16.04+375.26驱动+cuda8.0+cudnn5
- Vijos P1688 病毒传递
- 10. Regular Expression Matching
- H5页面定时器
- LINUX 系统备份和恢复(通过虚拟机试验)
- Gradle学习(六)——多项目构建
- 【Linux】【Windows】32/64,文件系统,磁盘分区,X86/ARM
- 仿qq横向滑动删除的 SwipeMenuListView
- Python爬虫---scrapy框架
- 微信支付兴起,万亿级用户交易记录存储的挑战
- WebService的发布流程和配置
- 对于陆熠学长的报告感悟和反思