我有以下网址:
http://www.mysite.co.uk/?location=mylocation1
我需要将URL中location
的值存储到变量中,并在jQuery代码中使用它。var thequerystring = "getthequerystringhere"
$('html,body').animate({scrollTop: $("div#" + thequerystring).offset().top}, 500);
我怎样才能使用 JavaScript 或 jQuery 获取那个值?
var locationValue = (new URL(location.href)).searchParams.get('location')
- soccer7