ASP/VBS and Javascript

E

Excel User

Hi,

Just wanted some advice, I have an asp page that has a script that creates
some values i.e.

<%
somevalue = "aaa"
somevalue2 = "bbb"

%>

also on the page I include some js scripts as:

<script type="text/javascript" src="sources.js"></script>

within the js scripts I would like to use some of vb values, but the js
throws an error, what is the best approach to use the values but keep the JS
external?

Thanks
 
E

Evertjan.

Excel User wrote on 24 sep 2009 in
microsoft.public.inetserver.asp.general:
Just wanted some advice, I have an asp page that has a script that
creates some values i.e.

<%
somevalue = "aaa"
somevalue2 = "bbb"

%>

also on the page I include some js scripts as:

<script type="text/javascript" src="sources.js"></script>

within the js scripts I would like to use some of vb values,

You probably mean the values of vb variables?

You probably mean VBS variables, as ASP does not platform VB.

They are just serverside variables,
it does not matter if they are made by ASP/vbscript or by ASP/Jscript.

"VD variables" could even be "clientdside variables" in IE.
but the js throws an error,

Because surely you made a coding error. Without showing the essential
code, the error throwing is irrelevant to your Q.
what is the best approach to use the values but
keep the JS external?

That is a bad idea.
Why would you ever want that?

An external js file is ment to be cached clientside,
so the imported values of serverside variables will not be actual.

Better have essential calls to the external file on the actual page, like

<script type="text/javascript" src="sources.js">
</script>
<script type='text/javascript'>
dostuff('<%= myASPvalue %>');
</script>

where the function is defined in the external script.

=========================

However you COULD rename the .js to .asp
and add session variables to the external script,
but the caching problem remails,
and the sense remains non.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top