Parsing 使用javascript解析URL(而不是querystring)文件夹结构域/parseThis/

Parsing 使用javascript解析URL(而不是querystring)文件夹结构域/parseThis/,parsing,url,Parsing,Url,我知道如何解析查询字符串,但收到的格式是:domainName/variable/somethingelseidontcareaout 我需要抓住中间的部分,这样我就能看到它说了什么。。。有什么帮助吗 谢谢! Todd如果您的原始url类似于http://domainname.com/variable/else,您可以使用此选项: document.location.href.split("/")[3] 如果没有,只需更改括号中的数字。nice!这是有道理的!呜!

我知道如何解析查询字符串,但收到的格式是:domainName/variable/somethingelseidontcareaout

我需要抓住中间的部分,这样我就能看到它说了什么。。。有什么帮助吗

谢谢!
Todd

如果您的原始url类似于
http://domainname.com/variable/else
,您可以使用此选项:

document.location.href.split("/")[3]

如果没有,只需更改括号中的数字。

nice!这是有道理的!呜!