0
我只想顯示一篇文章,但是當我將(0,2)更改爲(0,1)時沒有任何內容出現。有沒有快速的解決方案?僅在RSS訂閱中顯示1篇文章YUI
YUI().use('yql', function(Y){
var query = 'select * from rss(0,2) where url = "http://rss.cnn.com/rss/money_latest.rss"'
var q = Y.YQL(query, function(r){
//r now contains the result of the YQL Query as a JSON
var feedmarkup = '<div>'
var feed = r.query.results.item // get feed as array of entries
for (var i=0; i<feed.length; i++){
feedmarkup += '<p><a href="' + feed[i].link + '">'
feedmarkup += feed[i].title + '</a></p>'
feedmarkup += '<p>' + feed[i].description + '</p>' \t
\t \t \t feedmarkup += '<p><a href="' + feed[i].link + '">'
feedmarkup += '<span class="more">Read more</span>' + '</a></p>' \t \t
} \t \t
document.getElementById('uknews').innerHTML = feedmarkup
})
})
<script src="http://yui.yahooapis.com/3.18.1/build/yui/yui-min.js"></script>
<div id="uknews"></div>