首页 > 编程语言 > 详细

How to get URL parameters with Javascript?

时间:2014-12-09 19:29:00      阅读:220      评论:0      收藏:0      [点我收藏+]
function getURLParameter(name) {
  return decodeURIComponent((new RegExp(‘[?|&]‘ + name + ‘=‘ + ‘([^&;]+?)(&|#|;|$)‘).exec(location.search)||[,""])[1].replace(/\+/g, ‘%20‘))||null
}

So you can use:

myvar = getURLParameter(‘myvar‘);

 

How to get URL parameters with Javascript?

原文:http://www.cnblogs.com/dupeng0811/p/How_to_get_URL_parameters_with_Javascript.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!