Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ASP/VBS and Javascript

Reply
Thread Tools

ASP/VBS and Javascript

 
 
Excel User
Guest
Posts: n/a
 
      09-24-2009
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

 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      09-24-2009
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.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript and IE? Javascript and C#? porter Javascript 6 10-06-2007 10:03 AM
dynamic javascript and html using javascript parez Javascript 0 09-11-2007 04:08 PM
JavaScript or not JavaScript Mark Rae ASP .Net 36 09-09-2006 01:12 PM
href="javascript:func()" vs href="#" onclick="javascript:func()" CRON HTML 24 06-20-2006 08:05 PM
Javascript -> Applet: variable reset after method call from javascript?! mcdeveloper Java 1 06-13-2006 08:34 AM



Advertisments