<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<div id="news"></div>
<script language="JavaScript">
<!--
function readRss(url,n)
{
var xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = "false";
xml.load(url);
var str = "<div><strong>";
str += xml.selectSingleNode("/rss/channel/description").text;
str += "</strong></div><ul>";
var nodes = xml.selectNodes("/rss/channel/item");
for (var i=0; i<nodes.length && i<n; i++)
{
var title = nodes[i].selectSingleNode("title").text;
var link = nodes[i].selectSingleNode("link").text;
str += '<li><a href="'+link+'" target="_blank">'+title+'</a></li>';
}
str += "</ul>";
document.getElementById("news").innerHTML += str;
}
readRss("http://news.163.com/special/00011K6L/rss_newstop.xml",5);
readRss("http://news.163.com/special/00011K6L/rss_gn.xml",5);
//-->
</script>
</body>
</html>
xmlhttp因为安全原因,拒绝远程调用,因此最简单的实现方法是用shell每隔几分钟去把你需要的xml文件下载到自己的网站上,然后将readRss的地址改为自己网站的地址,这样就ok了。