window.location.hash常用方法
来源:互联网 发布:数据共享该怎样连接 编辑:程序博客网 时间:2024/06/05 17:42
window.location.href是在js中经常见到的获取url链接的方式
而我们在一些url中却看到过类似的地址
http://www.abc.com/a/index.html#m2
其中的#m2 就是location.hash
loation.hash常与锚点联系起来使用
例如:
<head> <script> function getAnchor(anchor_name) { window.location.hash=anchor_name; } </script> </head>
<body> <a href="javascript:getAnchor('test');">点我测试</a> <div style="height:2000px">test</div> <a name="test">destination</a></body>
当点击 测试 按钮时,实现页面位置的改变
location.hash通过与iframe的结合 还能巧妙的解决js代理完全跨域的问题
虽然有些麻烦,但是却可以解决js完全跨域的问题
详见:利用iframe和location.hash实现跨域
1 0
- window.location.hash常用方法
- window.location.hash解析
- window.location.hash解析
- window.location.hash详解
- window.location.hash详解
- 有关window.location.hash
- window.location.hash
- window.location.hash 使用说明
- window.location.hash
- window.location.hash 使用说明
- window.location.hash
- window.location.hash 使用说明
- window.location.hash属性介绍
- AJAX Navigation (window.location.hash)
- window.location.hash属性介绍
- window.location.hash使用总结
- window.location.hash属性介绍
- window.location.hash属性介绍
- cocos2d-x的定时器
- 县级公立医院改革明年推开 今年再增700试点
- 说微信O2O是新的商业模式还为时尚早
- VS2010 Web网站发布详解
- 【Spring】关于spring配置文件的位置
- window.location.hash常用方法
- 常用数据结构之Trie树
- SDUTOJ KMP简单应用 【KMP】
- zzhttp://bbs.csdn.net/topics/390705551
- OpenGL ES 2.0 windows开发环境搭建
- 【经典例题】三天打鱼两天晒网
- PCB的敷铜的作用
- 上班语录 2014-02-11
- 获得可用的内存 和 获得总内存