Implement rssreader using ASP + XMLHTTP

Source: Internet
Author: User

Demo: 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 Resource: <input type = "text" name = "rssfeed" size = 60 style = "height: 22px" value = "<% = request (" rssfeed ") %> "onfocus = select ()> <input type =" Submit "value =" Read it "> & nbsp; double-click the mouse to close the abstract. Only the title is displayed.
</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> Abstract:" & oitem (I). childnodes (4). Text & "</div> <br>"
Next
End if
%>

From: http://goaler.xicp.net/ShowLog.asp? Id = 513

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.