我正在尝试解析页面的网址.例如,当前页面是location.href.
所以我的博客的主页,如果我使用alert(location.href); 它会在警告框中返回" http://diaryofthedead.co.cc/ ".如果我使用alert(location.href); 在我的博客的第二页,它会在一个警告框中返回" http://diaryofthedead.co.cc/page/2 ".有没有办法解析URL以获得最后的数字.有谁知道我怎么能这样做?我可以使用通配符或其他东西来做类似的事情:location.href +"page /"+*;*等于"page /"后面的任何内容,然后将*转换为变量?