伊图教程网[www.etoow.com]
http://www.etoow.com/html/2007-08/1186276678.html
Set Ads=nothing
end sub
''以上完成远程存储文件,以下只适用于对文本型文件的操作
set fso=server.createobject("scripting.filesystemobject") ''读取文件内容
set fileout=fso.opentextfile(server.mappath(filepath),1)
content=fileout.readall
set fileout=nothing
set fso=nothing
''response.write content
contentarr=split(content,"<td") ''根据内容进行筛选
for i=1 to ubound(contentarr)
if instr(contentarr(i),"恩施") then thisloc=i
next
dim xu(5)
for j=0 to 4
con1=contentarr(thisloc+j)
start1=instr(con1,">")
con1=right(con1,len(con1)-start1)
stop1=instr(con1,"<")
con1=left(con1,stop1-1)
str=str&contentarr(thisloc+j)
xu(j)=trim(con1)
next
if xu(1)<>"" then
response.write "document.write('恩施州未来24小时天气预报:"&xu(1)&",最低温度"&xu(2)&"摄氏度,最高温度"&xu(3)&"摄氏度,风向:"&xu(4)&".--武汉中心气象台发布');"
else
response.write "document.write('暂未发布');"
end if
''response.write server.htmlencode(str)
%>
在另一个htm页中引用显示获取内容
<script src="getfile.asp"></script>
XMLHTTP组件获取远程文件并筛选出目标数据
'http://www.etoow.com/html/2007-08/1186276678.html