<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
window.onload = function() { function GetURLlist(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r != null) return unescape(r[2]);
return null;
} function GetUrlParam(paraName) {    
var url = document.location.toString();    
var arrObj = url.split("?");
if(arrObj.length > 1) {      
var arrPara = arrObj[1].split("&");      
var arr; 
for(var i = 0; i < arrPara.length; i++) {        
arr = arrPara[i].split("=");     
if(arr != null && arr[0] == paraName) {          
return arr[1];        
}      
}      
return "";    
}    
else {      
return "";    
}  
}
// 调用方法
console.log(GetURLlist("a"));
console.log(GetURLlist("b"));
console.log(GetURLlist("c"));
// 调用方法
console.log(GetUrlParam("a"));
console.log(GetUrlParam("b"));
console.log(GetUrlParam("c"));
}
</script>
</head> <body>
</body>

设置或获取对象指定的文件名或路径。

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)

最新文章

  1. 在 Linux 中安装 Oracle JDK 8 以及 JVM 的类加载机制
  2. 【转】 memcmp源码实现
  3. C#学习系列-String与string的区别
  4. C++ 中指针与引用的区别
  5. Leetcode Linked List Cycle II
  6. CHM文档打开空白的解决
  7. xamarin android——数据绑定到控件(二)
  8. Why your Games are Unfinished, and What To Do About It (转)
  9. BZOJ 2330: [SCOI2011]糖果( 差分约束 )
  10. [2011山东ACM省赛] Identifiers(模拟)
  11. GIT 版本控制命令学习
  12. 关于Vue问题记录
  13. 一个最简单的cell按钮点击回调
  14. webpack打包优化
  15. [已解决]Cannot find one or more components.Please reinstall the application
  16. 10;XHTML 其他标记
  17. HDFS笔记(一)
  18. Java并发编程-并发工具类及线程池
  19. nmon监控
  20. 浅谈js抽象工厂模式

热门文章

  1. linux获取系统启动时间
  2. ibatis XML标签的含义
  3. MVC concept
  4. [整理][LaTex]小技巧之——首行缩进
  5. Selenium2+python自动化25-js处理日历控件(修改readonly属性)
  6. Hdu OJ 5113 Black And White (2014ACM/ICPC亚洲区北京站) (搜索)
  7. 图解Android Studio导入Eclipse项目源码
  8. Java.web-application-development-environments-for-macosx
  9. AngularJs自定义指令详解(3) - scope
  10. html css 注释