asp下用fso生成js文件的代码
程序员文章站
2022-07-01 23:36:09
<%sub fsojs()%> <% set fso= server.createobject("scripti...
<%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%>