Loading

How to get URL parameters with Javascript?

function getURLParameter(name) {
  return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null
}

So you can use:

myvar = getURLParameter('myvar');

 

posted @ 2014-12-09 17:40  Dhoopu  阅读(631)  评论(0)    收藏  举报