牛人用rss做的自动更新的网站.
代码如下
- <td width="304" rowspan="2" align="left" valign="top">
- <%
- 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
- %><head>
- <body>
- <%
- call readrss("http://news.baidu.com/n?cmd=4&class=healthnews&tn=rss(换成你自己的RSS地址)")
- %>
- </td>
|