Javascript to read asp variable

Discussion in 'ASP General' started by Prabhat, Oct 31, 2005.

  1. Prabhat

    Prabhat Guest

    Hi All,

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


    Thanks
    Prabhat
    Prabhat, Oct 31, 2005
    #1
    1. Advertising

  2. Prabhat

    Evertjan. Guest

    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.

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Oct 31, 2005
    #2
    1. Advertising

  3. Prabhat

    Prabhat Guest

    "Evertjan." <> wrote in message
    news:Xns97007F9A424BDeejj99@194.109.133.242...
    >
    > Call it an .asp file and use it as a .js. file.
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Replace all crosses with dots in my emailaddress)


    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
    Prabhat, Oct 31, 2005
    #3
  4. Prabhat

    Evertjan. Guest

    Prabhat wrote on 31 okt 2005 in microsoft.public.inetserver.asp.general:
    > "Evertjan." <> wrote in message
    >>
    >> Call it an .asp file and use it as a .js. file.

    >
    > 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>




    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Oct 31, 2005
    #4
  5. Prabhat

    Prabhat Guest

    "Evertjan." <> wrote in message
    news:Xns970087353790Beejj99@194.109.133.242...
    > Prabhat wrote on 31 okt 2005 in microsoft.public.inetserver.asp.general:
    > > "Evertjan." <> wrote in message
    > >>
    > >> Call it an .asp file and use it as a .js. file.

    > >
    > > 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>
    >
    >
    >
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Replace all crosses with dots in my emailaddress)


    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
    Prabhat, Oct 31, 2005
    #5
  6. Prabhat

    Evertjan. Guest

    Prabhat wrote on 31 okt 2005 in microsoft.public.inetserver.asp.general:
    > "Evertjan." <> wrote in message
    >> Prabhat wrote on 31 okt 2005 in
    >> > "Evertjan." <> wrote in message
    >> >>
    >> >> Call it an .asp file and use it as a .js. file.
    >> >
    >> > 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>

    >
    > 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]


    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Oct 31, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shil
    Replies:
    2
    Views:
    2,024
    Eliyahu Goldin
    Jan 2, 2007
  2. Elliot
    Replies:
    2
    Views:
    750
    siccolo
    Jul 8, 2008
  3. Jonas Daunoravicius
    Replies:
    5
    Views:
    306
    Peter
    Jul 17, 2003
  4. Steve Cosh
    Replies:
    1
    Views:
    163
    joewiii
    Nov 18, 2005
  5. Jonas Daunoravicius
    Replies:
    5
    Views:
    282
    Peter
    Jul 17, 2003
Loading...

Share This Page