window.location实用知识
来源:互联网 发布:怎么修改淘宝评论 编辑:程序博客网 时间:2024/06/03 10:31
设置或获取对象指定的文件名或路径:alert(window.location.pathname)
设置或获取整个 URL 为字符串:alert(window.location.href)
设置或获取与 URL 关联的端口号码:alert(window.location.port)
设置或获取 URL 的协议部分:alert(window.location.protocol)
设置或获取 href 属性中在井号“#”后面的分段:alert(window.location.hash)
设置或获取 location 或 URL 的 hostname 和 port 号码:alert(window.location.host)
设置或获取 href 属性中跟在问号后面的部分:alert(window.location.search)
获取变量的值(截取等号后面的部分):
设置或获取整个 URL 为字符串:alert(window.location.href)
设置或获取与 URL 关联的端口号码:alert(window.location.port)
设置或获取 URL 的协议部分:alert(window.location.protocol)
设置或获取 href 属性中在井号“#”后面的分段:alert(window.location.hash)
设置或获取 location 或 URL 的 hostname 和 port 号码:alert(window.location.host)
设置或获取 href 属性中跟在问号后面的部分:alert(window.location.search)
获取变量的值(截取等号后面的部分):
var url = window.location.search;
alert(url.length);alert(url.lastIndexOf('='));
var loc = url.substring(url.lastIndexOf('=')+1, url.length);
阅读全文
0 0
- window.location实用知识
- window.location.hash知识汇总
- window.location
- window.location
- window.location
- window.location
- window.location
- window.location
- window.location
- window.location
- window.location
- window.location
- window.location
- window.location
- window.location
- document.location & window.location
- document.location&window.location
- window.open()、window.location()
- ajax 实现文件下载功能
- adb使用-详细教程(Awesome Adb)
- PAT --- 1006. 换个格式输出整数 (15)
- 【Redis源码剖析】
- View[3] scrollTo、scrollBy
- window.location实用知识
- map(multimap)与pair
- CentOS根据端口杀进程
- Ajax跨域请求保证同一个session的问题
- Java设计模式--迭代器模式【Iterator Pattern】
- 其它栈溢出技巧
- YAML 简介
- JAVA中堆和栈的区别
- 关于横竖屏切换的处理