加入收藏 | 设为首页 | 会员中心 | 我要投稿 东莞站长网 (https://www.0769zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

asp解析rss

发布时间:2022-04-11 04:31:40 所属栏目:Asp教程 来源:互联网
导读:% @language=VBScript% % 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.ValidateO
<% @language="VBScript"%>
 
<%
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 (item.Length-1)
Set title=item.Item(i).getElementsByTagName("title")
Set link=item.Item(i).getElementsByTagName("link")
Response.Write("<a href="""& link.Item(0).Text &""" target='_blank'>"& title.Item(0).Text &"</a><br>")
Next
end if
End Function
%>
<html>
<head>
<title>远程读取XML文件</title>
</head>
<body>
<%
call readrss("http://www.CuoXin.com/article/feed.asp")
%>
<br><br>
 
</body>
</html>

(编辑:东莞站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读