用Asp+XmlHttp实现RssReader功能

1<style>   
2body {margin:10px;background-color:#ffffff;margin-top:6px;}   
3form{margin:0px;}   
4* {font:12px tahoma;line-height:140%;color:#000000}   
5.title {font-weight:bold;color:red;}   
6.time {font:10px;color:#999999;}   
7a {text-decoration:none;color:blue;}   
8</style>
1<script type="text/javascript">   
2var switcher=0;   
3</script>
1<body ondblclick="if(switcher==0){document.styleSheets[0].addRule('div','display:none');switcher=1}else{document.styleSheets[0].addRule('div','display:block');switcher=0}">
2<form action="" method="post" name="rssform">   
3RSS资源:<input ```"="" name="RssFeed" onfocus="select()" rssfeed")="" size="60" style="height:22px" type="text" value="```
4=request("/> <input type="submit" value="Read It"/>   双击鼠标可以关闭摘要,只显示标题   
5</form>
6<hr/>   

If(request("RssFeed")="") Then
url="/rss2.asp"
else
url=request("RssFeed")
End If

Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", url, False
xml.Send

Set xmlDom = server.createObject("microsoft.xmldom")
xmlDom.async=False
xmlDom.ValidateOnParse=false
xmlDom.load(xml.responseXML)

if xmlDom.ReadyState&gt;2 Then

set oItem=xmlDom.getElementsByTagName("item")

for i=0 to oItem.length-1
response.write "<span style="font:bold 9px verdana;color:#000000">"&amp;i+1&amp;"</span>. <a class="title" href='"&amp;oItem(i).childNodes(1).text&amp;"' target="_blank">"&amp;oItem(i).childNodes(0).text&amp;"</a> <span class="time">["&amp;oItem(i).childNodes(3).text&amp;"]<br/>"
response.write "<div>摘要:"&amp;oItem(i).childNodes(4).text&amp;"</div><br/>"
next
end if

Published At
Categories with Web编程
Tagged with
comments powered by Disqus