JS基于时间戳写的浏览访问人数
2024-10-18 11:49:24
Title:JS基于时间戳写的浏览访问人数 --2013-12-23 14:07
<script language="JavaScript">
var timestamp,timetmp,rand;
rand = Math.floor(Math.random()*10); //随机数
timestamp = new Date().getTime().toString(); //时间戳
timetmp = (parseInt(timestamp)/1000/60).toString(); //截取长度+随机数
timetmp = timetmp.substring(2,8);
timetmp = (parseInt(timetmp)-120000).toString();
if(timetmp.length==4){
timetmp = "00"+timetmp;
}else if(timetmp.length==5){
timetmp = "0"+timetmp;
}
var aa = $(".rs_A");
for(var i=0; i < timetmp.length; i++){
aa[i].innerHTML = timetmp.substr(i,1);
}
</script>
最后给LI标签赋值
<script language="JavaScript">
var timestamp,timetmp,rand;
rand = Math.floor(Math.random()*10); //随机数
timestamp = new Date().getTime().toString(); //时间戳
timetmp = (parseInt(timestamp.substr(5,6))+rand).toString(); //截取长度+随机数
document.write("时间戳:"+timestamp);
document.write('</br>');
document.write("随机数:"+rand);
document.write('</br>');
document.write("访问量:"+timetmp);
</script>
实用的话,还得再改改。
最新文章
- ubuntu文件夹建立软链接方法
- linux /etc/rc.d/目录的详解
- GPG操作——签名验证
- ThreadLocal实现方式&;使用介绍---无锁化线程封闭
- 【转】基于Ubuntu 14.04 LTS编译Android4.4.2源代码
- 如何使用滑动菜单SlidingMenu?
- [个人小工具]清除SVN控制
- 第一次作业:来自一个奋斗的IT学子
- SQLServer之创建INSTEAD OF INSERT,UPDATE,DELETE触发器
- mybatis 错误
- Python学习笔记三
- 阿里八八Beta冲刺博客集合贴
- Datasnap 服务端 (Server)Session 管理 --- 解决 全示例慢(Google)
- [leetcode]72. Edit Distance 最少编辑步数
- 前端面试题整理——javaScript部分
- python 全栈开发,Day101(redis操作,购物车,DRF解析器)
- Eclipse的快捷键使用总结
- 如何处理App的Application的事件
- Redis搜索引擎设计
- 3dmax坐标系与导出fbx的坐标系
热门文章
- 利用spring AOP 实现统一校验
- SetupFactory +添加frm2.0工具
- Java读书笔记二(封装类)
- [io PWA] keynote: Launching a Progressive Web App on Google.com
- android开发launcher
- mysql 大表 Sharding [转]
- LinkButton和HyperLink的页面跳转用法
- MVC使用Exception过滤器自定义处理Action的的异常
- tomcat启动项目内存溢出问题
- 该项目中不存在目标 precomputecompiletypescript The target ";PreComputeCompileTypeScript"; does not exist in the project