;}
//获取按钮,获取指定RSS
private void GetFeed_Click(object sender, System.EventArgs e)
{
if(FeedUrl.Text == "")//RSS地址
{
RssFeed.Text = "信息源不能为空,您可刷新重试或联系管理员!";
return ;
}
RssFeed.Text = LoadRSS(FeedUrl.Text,Convert.ToInt32(Num.Text)); //获取指定数目
}
3.无刷新动态更新的在线RSS阅读获取
<%@ Page language="c#" Codebehind="XmlHttp.aspx.cs" AutoEventWireup="false" Inherits="LiTianPing.XmlHttp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>XmlHttp</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<style>td { font-size: 9pt}
</style>
<script>
<!--
var oDiv
var xh
function getXML()
{
xh =new ActiveXObject("Microsoft.XMLHTTP");
oDiv = document.getElementById("rssitem");
oDiv.style.display= "";
try
{
//如果是本地改成下面语句直接读取
//xh.open("GET","/Rss.aspx",false);
xh.open("GET","Http://ltp.cnblogs.com/Rss.aspx",false);
xh.send(null);
loadData(xh,oDiv);
}
catch(e)
{
error(oDiv);
}
}
function loadData(xh,oDiv)
{
if (xh.readyState == 4)
{
xml = xh.responsexml;
var i;
var nodes = xml.selectNodes("/rss/channel/item");
var bloglink = xml.selectSingleNode("/rss/channel/link").text;
oDiv.innerHTML = "";
var html;
for(i=0;i<nodes.length;i++)
{
html += "<div >";
html += " <div >";
& |