<%
'========================================================================
'读取Rss
'========================================================================
Function readrss(xmlseed)
dim xmlDoc
dim http
Set http=Server.CreateObject("Microsoft.XMLHTTP")
http.Open "GET",xmlseed,False
http.send
Set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.Async=False
xmlDoc.ValidateOnParse=False
xmlDoc.Load(http.ResponseXML)
Set item=xmlDoc.getElementsByTagName("item")
if item.Length<=10 then
%>
<script language="JavaScript">
alert("对不起,该新闻条数已经少于10条新闻条数!");
</script>
<%
else
For i=0 To 9
Set title=item.Item(i).getElementsByTagName("title")
Set link=item.Item(i).getElementsByTagName("link")
Set pubDate=item.Item(i).getElementsByTagName("pubDate")
Response.Write("<a href="""& link.Item(0).Text &""" target='_blank'>"& title.Item(0).Text&"</a>"&sFormattime(pubDate.Item(0).Text)&"<br>")
Next
end if
End Function
Function sFormattime(ltime)
dim stime
stime=split(ltime, " ")
ftime=stime(1)
response.write ftime
end Function
%>
<%
call readrss("http://news.sohu.com/rss/focus.xml")
%>
posted on 2007-07-24 10:32
影子 阅读(82)
评论(0) 编辑 收藏