[Javascript] SRC=Javascript file

Ken Schaefer ken at adOpenStatic.com
Thu Apr 19 05:08:39 CDT 2001


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: You know how you can link to a file in Script ie
:
: <script src=js.asp>
: </script>
:
: In that file, how can I escape the JS code....eg
: I might  have
: alert ("Hello world")
:
: but then I might want to use some ASP script to
: get another value eg
:
: <% txt=now  %>
: alert (txt);
:
: Can I do that somehow?  Didn't seem to work when I tried it.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ASP is all done server-side - before anything is sent to the client. You
need to Response.Write the ASP stuff to the HTTP stream that is sent to the
client, eg:

alert("<% Response.Write("Hello World")%>");

or

var strVar = "<% Response.Write("Hello World")%>";
alert(strVar);

HTH

Cheers
Ken





More information about the Javascript mailing list