- ·上一篇文章:prototype例子--ajax无刷新用户登录
- ·下一篇文章:AJAX乱码解决方法
用Asp+XmlHttp实现RssReader功能
<
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(&
#39
div&
#39
,&
#39
display:none&
#39
)
switcher=1}else
{document.styleSheets[0].addRule(&
#39
div&
#39
,&
#39
display:block&
#39
)
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"
>
 
&
#38
nbsp
&
#38
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=&
#39
font:bold 
9px 
verdana
color:
#000000&
#39
>
"
&
#38
i+1&
#38
"
<
/span>
. 
<
a 
class=&
#39
title&
#39
 
href=&
#39
"
&
#38
oItem(i).childNodes(1).text&
#38
"
&
#39
 
target=&
#39
_blank&
#39
>
"
&
#38
oItem(i).childNodes(0).text&
#38
"
<
/a>
 
<
span 
class=&
#39
time&
#39
>
["
&
#38
oItem(i).childNodes(3).text&
#38
"
]<
br 
/>
"
 
 
 
 
response.write 
"
<
div>
摘要:"
&
#38
oItem(i).childNodes(4).text&
#38
"
<
/div>
<
br>
"
 
 
next
end 
if
%>
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(&
#39
div&
#39
,&
#39
display:none&
#39
)
switcher=1}else
{document.styleSheets[0].addRule(&
#39
div&
#39
,&
#39
display:block&
#39
)
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"
>
 
&
#38
nbsp
&
#38
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=&
#39
font:bold 
9px 
verdana
color:
#000000&
#39
>
"
&
#38
i+1&
#38
"
<
/span>
. 
<
a 
class=&
#39
title&
#39
 
href=&
#39
"
&
#38
oItem(i).childNodes(1).text&
#38
"
&
#39
 
target=&
#39
_blank&
#39
>
"
&
#38
oItem(i).childNodes(0).text&
#38
"
<
/a>
 
<
span 
class=&
#39
time&
#39
>
["
&
#38
oItem(i).childNodes(3).text&
#38
"
]<
br 
/>
"
 
 
 
 
response.write 
"
<
div>
摘要:"
&
#38
oItem(i).childNodes(4).text&
#38
"
<
/div>
<
br>
"
 
 
next
end 
if
%>
用Asp+XmlHttp实现RssReader功能