阅读内容 

简单析取html文件实例

[日期:2005-11-19] 来源:易书网  作者:易水风寒 [字体: ]
用offline下载了一些小说,放在局域网上,想用自己设计的页面显示,内容放在一个table中,如果取全部HTML,会有效果问题,因此只取<body ....> </body>之间的,代码如下:
<%
dim filepath
filepath=replace(Request.QueryString ("tar"),chr(34),"")
filepath=Server.MapPath(filepath)
set x=server.CreateObject ("Scripting.FileSystemObject")
set y=x.OpenTextFile (filepath,1,false)
result=y.readall()
y.close
set y=nothing
set x=nothing
'end if
result=lcase(result)
''''''''''''''''''''''''
result=mid(result,instr(result,"<body"),instr(result,"</body>"))
result=replace(result,"</body>","")
result=mid(result,instr(result,">")+1)
''''''''''''''''''''''''
''以下,把所有打开文件中的连接转换
''<a href="c.HTML">---><a href="show.ASP?tar=c.html">
''               或---><a href="show.ASP?tar=a/b/c.HTML">
if instr(request.querystring("tar"),"/")<>0 then
dim temp
temp=left(request.querystring("tar"),instrrev(request.querystring("tar"),"/"))
result=replace(result,"href=../../" & chr(34),"href=../../" & chr(34) & "show.ASP?tar=" & temp)

else
''
result=replace(result,"href=../../" & chr(34),"href=../../" & chr(34) & "show.ASP?tar=")
end if
Response.Write "<pre>" & result & "</pre>"
%>
阅读:
录入:

推荐 】 【 打印
相关新闻      
本文评论       全部评论
发表评论
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款


点评: 字数
姓名:
Advertisement
内容查询


Advertisement