javascript - Writing to JS file with ASP -
is possible write info js file in asp? know can write txt files, i've done, when try same method js files, doesn't seem work. i'm php programmer i'm used using fopen
, fwrite
of file types , curious if there's similar in asp. help!
your question bit weird, going try , answer in 3 different ways , perhaps can choose fits scenario. in future try detailed possible.
if asking if can use javascript scripting language asp pages, versus using vb script answer yes. asp can work few languages including perl, , javascript (jscript). need declare on top of asp page, , stick language whole page (cannot mix languages). <%@ language= "javascript" %>
if asking if can create physical files .js extensions on server, answer again true. use filesystemobject create these physical files, , write lines have javascript code. want make sure close file streams , fso objects. practice write temp location, copy production location when writing done (all via fso methods). biggest challenge run type of coding iuser permissions directories trying write files to. fso great writing logs, should not used generate javascript.
if looking create dynamic javascript have few options. go iis , let iis know .js files should handled asp.dll. means files requested .js extension run through whole asp pipeline , code <% blocks %> run. alternately, if can have .asp extension javascript file. example if want create following user variables database this.
<%
response.clear() response.contenttype = "text/javascript"
dim userid userid = "frank1979" ' database or whatever.
' write out javascript variable use on client side. ' create global js variable named userid value of frank1979 response.write "var userid = " & lcase(userid) & ";"
%>
Comments
Post a Comment