方案 1
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("feeds", "1");
function initialize() {
var feed = new google.feeds.Feed("rss地址");
feed.load(function(result) {
if (!result.error) {
var container = document.getElementById("feed");
for (var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
var div = document.createElement("div");
div.appendChild(document.createTextNode(entry.title));
container.appendChild(div);
}
}
});
}
google.setOnLoadCallback(initialize);
</script>
</head>
<body>
<div id="feed"></div>
</body>
除了entry.title外,還有entry.link,entry.publishedDate entry.contentSnippet 方案 2
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script language="Javascript" type="text/javascript">//<![CDATA[
// load the AJAX Feed API
google.load("feeds", "1");
function OnLoad() {
// create a feed control
var feedControl = new google.feeds.FeedControl();
feedControl.addFeed("rss地址", "");
feedControl.draw(document.getElementById("feedControl"));
}
google.setOnLoadCallback(OnLoad);
//]]>
</script>
</head>
<body>
<div id="feedControl">Loading</div>
</body>