用Asp+XmlHttp实现RssReader功能

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 applebbs 的 blog

演示:http://goaler.xicp.net/rssreader.asp

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

  set oitem=xmldom.getelementsbytagname("item")

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


转自: http://goaler.xicp.net/showlog.asp?id=513

本文关键:用Asp+XmlHttp实现RssReader功能
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top