訪問博客帖子鏈接名單上有簡單的Blogger JSON提要如何與下一個先前
<script type='text/javascript'>
function mycallback(json) {
for (var i = 0; i < json.feed.entry.length; i++) {
for (var j = 0; j < json.feed.entry[i].link.length; j++) {
if (json.feed.entry[i].link[j].rel == 'alternate') {
var postUrl = json.feed.entry[i].link[j].href;
break;
}
}
var postTitle = json.feed.entry[i].title.$t;
var item = '<ul><li><a href=' + postUrl + '>' + postTitle + '</a></li></ul>';
document.write(item);
}
}
</script>
<button type="button">Prev</button>
<button type="button">Next</button>
<h2>Recent Post</h2>
<script src='https://techtovillage.blogspot.com/feeds/posts/default?orderby=published&max-results=1000&alt=json-in-script&callback=mycallback'></script>
此代碼顯示我的總帖子鏈接列表。 如何將所有帖子鏈接分成5個鏈接列表,並訪問所有帖子鏈接與下一個prev按鈕