hash 模拟url路由

function hashdone(){
       var hash;
       hash=(!window.location.hash)?"#one":window.location.hash;
       window.location.hash=hash;
       var hashStr = location.hash.replace("#","");
       switch(hash){
           case "#one":
               alert(hashStr)
 
               break;
           case "#second":
               alert(hashStr)
 
               break;
           case "#third":
               alert(hashStr)
 
               break;
 
 
       }
   }
   hashdone()
 window.onhashchange=function(){
    hashdone()
 
 }

最新文章

  1. [LeetCode] Pow(x, n) 求x的n次方
  2. 贪吃蛇(Java实现)
  3. django的分页
  4. POJ1584 判断多边形是否为凸多边形,并判断点到直线的距离
  5. .Net开源网络爬虫Abot介绍
  6. Bzoj3531: [Sdoi2014]旅行
  7. 编写高质量代码改善C#程序的157个建议[IEnumerable<T>和IQueryable<T>、LINQ避免迭代、LINQ替代迭代]
  8. bootstrap兼容IE
  9. wcf 远程终结点已终止该序列 可靠会话出错
  10. ♫【异步】短小强悍的JavaScript异步调用库
  11. linux分区和系统文件和挂载
  12. HTML 基础语言
  13. Amazing ASP.NET Core 2.0
  14. Hive篇--搭建Hive集群
  15. 离线安装redis-cluster
  16. bootstrap 中关于 HTML5 aria-* and role的用法
  17. c++ CreateProcess调用dos命令
  18. 利用channel在goroutins之间控制同步和传递数据
  19. 在Unity中使用Lua脚本
  20. cocos游戏网址

热门文章

  1. 卡在 构建 gradle 项目信息
  2. Bzoj3677:树形DP
  3. [Java]struts2-spring整合时配置监听器
  4. 如何快速将Linux文件系统迁移到Azure存储
  5. SGU 200. Cracking RSA (高斯消元求自由变元个数)
  6. Software UART, Timer, PWM, External Interrupt
  7. MDK5 and STM32Cube
  8. oracle like 条件拼接
  9. CVPR 2017
  10. 【python】python读写文件,都不乱码