使用asp将html文件生成js文件的方法,共有两个文件:
文件一:creatjs.htm
主要是一个选择文件地址和生成地址的表单
文件二:creatjs.asp
包含生成js关键代码
<%
infile=request.form("infile")
outfile=request.form("outfile")
response.write(infile&"..........."&outfile&"
")
%>
<%
'以下为asp生成js文件的关键代码
set fs=server.createobject("scripting.filesystemobject")
'countfile=server.mappath(infile)
set txt=fs.opentextfile(infile)
set out = fs.createtextfile(server.mappath("../js/"&outfile),8, true)
do until txt.atendofstream
s=txt.readline
s=replace(s,"’","/’")
s2="document.write(’"&s&"’)"
response.write(s&chr(13))
out.writeline(s2)
loop
txt.close
out.close
set fs=nothing
%>