用ASP+FSO生成JS文件
人气:0想了解用ASP+FSO生成JS文件的相关内容吗,在本文为您仔细讲解的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:用ASP+FSO生成JS文件,下面大家一起来学习吧。
复制代码 代码如下:
<!--#include file="conn.asp"-->
<%
set js = server.CreateObject("ADODB.RecordSet")
sql="select top 10 * from article order by id desc"
set js = conn.Execute (Sql)
do while not js.eof
title=js("title")
addate=js("addate")
foolcat = foolcat + "<li><a href=""/"& js("id")&".htm"">" &title&" "&addate&"</a></li><br>"
js.movenext
loop
'生成JS文件
foolcat = "" + foolcat + ""
foolcat = "document.write('" & foolcat & "')"
FolderPath = Server.MapPath("./")
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.CreateTextFile(FolderPath&"\top10.js")
fout.WriteLine foolcat
'关闭连接
fout.close
set fout = nothing
js.close
set js = nothing
conn.close
set conn=nothing
%>
<%
set js = server.CreateObject("ADODB.RecordSet")
sql="select top 10 * from article order by id desc"
set js = conn.Execute (Sql)
do while not js.eof
title=js("title")
addate=js("addate")
foolcat = foolcat + "<li><a href=""/"& js("id")&".htm"">" &title&" "&addate&"</a></li><br>"
js.movenext
loop
'生成JS文件
foolcat = "" + foolcat + ""
foolcat = "document.write('" & foolcat & "')"
FolderPath = Server.MapPath("./")
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.CreateTextFile(FolderPath&"\top10.js")
fout.WriteLine foolcat
'关闭连接
fout.close
set fout = nothing
js.close
set js = nothing
conn.close
set conn=nothing
%>
加载全部内容