Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript inside a JS file

Status
Not open for further replies.

bmdev

Programmer
May 13, 2003
29
US
Hello,

I'm trying to reference a session variable inside a Javascript routine which is inside an include file XXX.js. I can put the same code in my asp page in some Javascript and it works fine.

var var1 = "<%=Session("SomeValue")%>";

I keep getting an error that I'm missing a "}"

Any ideas?

Thanks!!

 
Since the external Javascript file doesn't have an ASP extension, any ASP inside it is not processed on the server. If you want ASP in an external JS file processed, you need to include it on the page, not load it as an external script file. Otherwise it will be loaded on the client computer and run there.

Lee
 
I don't believe that the include file is parsed by the server because you are including it from the client-side.

Can you inlcude it like this

<!-- #include file="../includes/myJS.inc" -->

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
zen.gif

 
You have to use <script> tags in it like a regular HTML page when you include it.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top