OA中的RSS

 <html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
 <link rel="stylesheet" href="../putong_1t.css">
  <script LANGUAGE="vbscript">
 <!--
 sub bb(obj)
     if document.getElementById(obj) is nothing then
         exit sub
     end if
     if document.getElementById(obj).style.display="none" then
         document.getElementById(obj).style.display="block"
         document.getElementById("img" & obj).src="../image/menu_open.gif"
     else
         document.getElementById(obj).style.display="none"
         document.getElementById("img" & obj).src="../image/menu_close.gif"
     end if
    
 end sub
 //-->
 </script>
 </head>
<body>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="32"><img src="../images/index_zi_01.gif" width="32" height="33"></td>
    <td width="8"><img src="../images/index_zi_02.gif" width="8" height="33"></td>
    <td width="1192" background="../images/index_zi_04.gif">RSS信息中心  </td>
    <td width="11"><img src="../images/index_zi_06.gif" width="8" height="33"></td>
  </tr>
</table>
<table width="100%"  border="0" cellspacing="0" cellpadding="0" height="24">
   <tr>
    <td width="1%"><img src="../images/index_zi_07.gif" width="11" height="24" alt=""></td>
    <td width="30%" background="../images/index_zi_09.gif" align="left">RSS信息列表</td>
    <td width="67%" background="../images/index_zi_09.gif" align="right">&nbsp;
  </td>
    <td width="2%"><img src="../images/index_zi_11.gif" width="20" height="24"></td>
  </tr>
</table>
<table class="tableframe" width="98%" align="center">
 <tr class="listtitle">
   <td width="8%" height="10" align=left class="listcelltitle">编号
 </td>
   <td width="42%" align=left class="listcelltitle">标题</td>
   <td width="50%" align=left class="listcelltitle">类别</td>
 </tr>
<%
call readrss("http://rss.sina.com.cn/news/allnews/tech.xml",3,"国内新闻")
call readrss("http://rss.sina.com.cn/news/allnews/astro.xml",4,"金途OA升级")
call readrss("http://home.donews.com/rss.xml",3,"OA")
call readrss("http://www.cnblogs.com/winner/Rss.aspx",400,"MY_blogs")


%>
</table>
</body>
</html>
<%
 '*************************************以上是时间转换的函数************************88
Function readrss(xmlseed,my_line,mytype)
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")
number=item.length   '得到所得取的RSS页中一共有多少项

if my_line<>"" then
 if my_line>number then    '如果传过来参数大于总条数
    my_line=number
 end if
else

end if
tt=0  '判断奇偶行
  For i=0 To (my_line-1)
  Set title=item.Item(i).getElementsByTagName("title")
  Set link=item.Item(i).getElementsByTagName("link")
  set pubDate=item.item(i).getElementsByTagName("pubDate")
   if tt mod 2 =0 then
    mycss="class=TrOneColor"
   else
    mycss="class=TrTwoColor"
   end if
   Response.Write("<tr "& mycss &" ><td class='listcelltitle' height='18' align=left>"& i+1 &"</td><td class='listcelltitle' align=left><a href="""& link.Item(0).Text &""" target='_blank'>"& title.Item(0).Text &"</a>("& myformatdate(pubDate.item(0).text) &")</td><td class='listcelltitle' align=left>"& mytype &"</td></tr>")
    tt=tt+1 
 Next
 
 
  Response.Write("<tr "& mycss &" ><td class='listcelltitle' height='18' align=left></td><td class='listcelltitle' align=left></td><td class='listcelltitle' align=right>More</td></tr>")
End Function

function myformatdate( mydate )
  if len(mydate)>len(now()) then
  mydate =left(mydate,len(mydate)-4)
  mydate=right( mydate,len(mydate)-5 )
   myformatdate=mydate
  else
   myformatdate=mydate
  end if
end function
%>

<%
function formatdatetime_active(s,spt1,spt2,tag)
'格式化日期时间s为要格式化的日期时间,spt1为日期之间的分隔符spt2为时间之间的分隔符,tag为1表示要显示时间,否则不显示tag为2表示显示秒
 if not isdate(s) then
  formatdatetime_active=s
  exit function
 end if
  dim s1,s2
  s1=cdate(s)
  s2=cstr(year(s1)) & spt1 & string(2-len(cstr(month(s1))),"0") & cstr(month(s1)) & spt1 & string(2-len(cstr(day(s1))),"0") & cstr(day(s1))
 if tag=1 or tag=2 then
  s2=s2 & " " & string(2-len(cstr(hour(s1))),"0") & cstr(hour(s1)) & spt2 & string(2-len(cstr(Minute(s1))),"0") & cstr(Minute(s1))
 end if
 if tag=2 then
  s2=s2 & spt2 & string(2-len(cstr(Second(s1))),"0") & cstr(Second(s1))
 end if
     formatdatetime_active=s2
end function
%>

原文地址:https://www.cnblogs.com/winner/p/592383.html