asp下用fso生成js文件的代码
(编辑:jimmy 日期: 2024/11/17 浏览:3 次 )
<%sub fsojs()%>
<%
Set fso= Server.CreateObject("Scripting.FileSystemObject")
set fd=fso.createtextfile(server.MapPath("../category.js"),true)
'开始操作
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from dept_category",conn,1,1
str="var onecount;"&vbcrlf&"onecount=0;"&vbcrlf&"subcat = new Array();"
for i=1 to rs.recordcount
str=str&vbcrlf&"subcat["&(i-1)&"] = new Array('"&rs("category")&"','"&rs("parentid")&"','"&rs("categoryid")&"');"
rs.movenext
Next
str=str&vbcrlf&" onecount="&rs.recordcount&";"&vbcrlf
fd.writeline str
%>
<%end sub%>
<%
Set fso= Server.CreateObject("Scripting.FileSystemObject")
set fd=fso.createtextfile(server.MapPath("../category.js"),true)
'开始操作
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from dept_category",conn,1,1
str="var onecount;"&vbcrlf&"onecount=0;"&vbcrlf&"subcat = new Array();"
for i=1 to rs.recordcount
str=str&vbcrlf&"subcat["&(i-1)&"] = new Array('"&rs("category")&"','"&rs("parentid")&"','"&rs("categoryid")&"');"
rs.movenext
Next
str=str&vbcrlf&" onecount="&rs.recordcount&";"&vbcrlf
fd.writeline str
%>
<%end sub%>
下一篇:Asp无组件生成缩略图的代码