共计 126 个字符,预计需要花费 1 分钟才能阅读完成。
使用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.atendofstreams=txt.readlines=replace(s,"’","/’")s2="document.write(’"&s&"’)"response.write(s&chr(13))out.writeline(s2)looptxt.closeout.closeset fs=nothing%>
正文完