复制代码 代码如下:
<!--#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
%>
申明:本教程内容由威凡网编辑整理并提供IT程序员分享学习,如文中有侵权行为,请与站长联系(QQ:254677821)!