Using location.search to locate a parameter's value
问题 I’m working on a tool which takes the value parameters in the URL and does a few things with them. My issue is, I can’t seem to use document.location to show the specific value that I’m after, for example: www.examplesite.com?yourname=gilgilad I want to use document.location.search and put it in a var, I need that var's value to be "gilgilad". Is this even possible using location.search? 回答1: location.search will return all after question mark including it. So there is universal js to get