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>

  实用的话,还得再改改。

最新文章

  1. ubuntu文件夹建立软链接方法
  2. linux /etc/rc.d/目录的详解
  3. GPG操作——签名验证
  4. ThreadLocal实现方式&amp;使用介绍---无锁化线程封闭
  5. 【转】基于Ubuntu 14.04 LTS编译Android4.4.2源代码
  6. 如何使用滑动菜单SlidingMenu?
  7. [个人小工具]清除SVN控制
  8. 第一次作业:来自一个奋斗的IT学子
  9. SQLServer之创建INSTEAD OF INSERT,UPDATE,DELETE触发器
  10. mybatis 错误
  11. Python学习笔记三
  12. 阿里八八Beta冲刺博客集合贴
  13. Datasnap 服务端 (Server)Session 管理 --- 解决 全示例慢(Google)
  14. [leetcode]72. Edit Distance 最少编辑步数
  15. 前端面试题整理——javaScript部分
  16. python 全栈开发,Day101(redis操作,购物车,DRF解析器)
  17. Eclipse的快捷键使用总结
  18. 如何处理App的Application的事件
  19. Redis搜索引擎设计
  20. 3dmax坐标系与导出fbx的坐标系

热门文章

  1. 利用spring AOP 实现统一校验
  2. SetupFactory +添加frm2.0工具
  3. Java读书笔记二(封装类)
  4. [io PWA] keynote: Launching a Progressive Web App on Google.com
  5. android开发launcher
  6. mysql 大表 Sharding [转]
  7. LinkButton和HyperLink的页面跳转用法
  8. MVC使用Exception过滤器自定义处理Action的的异常
  9. tomcat启动项目内存溢出问题
  10. 该项目中不存在目标 precomputecompiletypescript The target &quot;PreComputeCompileTypeScript&quot; does not exist in the project