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