我有一个类似 http://blog.com/post/1
的 URL,我需要一个函数来更新其末尾的数字以进行分页。
到目前为止我已经:
window.location(document.URL++);
最佳答案
var url = window.location.href.split('/'),
page = parseInt(url.pop(), 10);
// to go to next page, increment page number and join with URL
window.location.href = url.join('/') +'/'+ (++page);
关于javascript - URL 中的数字逐渐增加 - JavaScript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16779762/