Javascript to read asp variable

P

Prabhat

Hi All,

Is it possible to read any ASP variable from a javascript file (.js) ?


Thanks
Prabhat
 
E

Evertjan.

Prabhat wrote on 31 okt 2005 in microsoft.public.inetserver.asp.general:
Is it possible to read any ASP variable from a javascript file (.js) ?

Call it an .asp file and use it as a .js. file.
 
P

Prabhat

Evertjan. said:
Call it an .asp file and use it as a .js. file.

Hi,

Actually I call the .js file from the home page like:
<script type='text/javascript' src='Scripts/MenuScript.js'></script>

So How can I proceed. I have the menu Links in the .js file (some of the
links are also points to other web sites). So I am updating the web site so
that where ever I have used the specific link (say: www.abc.com) that should
now read a ASP variable dynamically. I have 2 lines in the above .js file
and I want that 2 lines to read the same ASP variable. Hope you are able to
understand.

Thanks
Prabhat
 
E

Evertjan.

Prabhat wrote on 31 okt 2005 in microsoft.public.inetserver.asp.general:
Actually I call the .js file from the home page like:
<script type='text/javascript' src='Scripts/MenuScript.js'></script>

Don't.

If you want to use lines in that file like this:

var blahClientside = '<% =blahServersideVBSorJS %>';

use:

<script type='text/javascript' src='Scripts/MenuScript.asp'></script>
 
P

Prabhat

Evertjan. said:
Prabhat wrote on 31 okt 2005 in microsoft.public.inetserver.asp.general:

Don't.

If you want to use lines in that file like this:

var blahClientside = '<% =blahServersideVBSorJS %>';

use:

<script type='text/javascript' src='Scripts/MenuScript.asp'></script>

Hi

You want me to change the "MenuScript.js" file to "MenuScript.asp" and
Include the line I wanted to use in javascript file?

and then:
I will use the below line in my home page ("default.htm")?
<script type='text/javascript' src='Scripts/MenuScript.asp'></script>

But if so will the "script type='text/javascript' " still work ?

Thanks
Prabhat
 
E

Evertjan.

Prabhat wrote on 31 okt 2005 in microsoft.public.inetserver.asp.general:
You want me to change the "MenuScript.js" file to "MenuScript.asp" and
Include the line I wanted to use in javascript file?

and then:
I will use the below line in my home page ("default.htm")?
<script type='text/javascript' src='Scripts/MenuScript.asp'></script>

But if so will the "script type='text/javascript' " still work ?

That is what I am trying to tell you,
but better than believing me, try it out.]

Using a session variable:
var blahClientside = '<% =session("blahServersideVBSorJS") %>';

Or the server time:
var timeOnServer = '<% =now %>';


btw:
About the same goes for:
<img src='myJpg.asp'>
[as long as you send an image stream with the right disposition header]
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top