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