日期:2011-12-09  浏览次数:20856 次

用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>"
%>