newbie: how to use global ASP variable in jscript?

Discussion in 'ASP General' started by Bart Plessers \(artabel\), Sep 17, 2003.

  1. Hello,

    I want to have my function in jscript make use of the variables in an
    asp-page.
    How can I read the contents of a variable in the function (I don't want to
    pass them as an argument)

    tia

    bartp

    --
    HyperART
    Paul Van Ostaijenlaan 4
    3001 Heverlee
    Bart Plessers \(artabel\), Sep 17, 2003
    #1
    1. Advertising

  2. Bart Plessers \(artabel\)

    Ray at Guest

    <%@ Language="JScript" %>
    <%

    var x=3;
    writeTheVar();

    function writeTheVar()
    {
    Response.write(x)
    }
    %>

    Ray at work



    "Bart Plessers (artabel)" <> wrote in message
    news:...
    > Hello,
    >
    > I want to have my function in jscript make use of the variables in an
    > asp-page.
    > How can I read the contents of a variable in the function (I don't want to
    > pass them as an argument)
    >
    > tia
    >
    > bartp
    >
    > --
    > HyperART
    > Paul Van Ostaijenlaan 4
    > 3001 Heverlee
    >
    >
    >
    Ray at, Sep 17, 2003
    #2
    1. Advertising

  3. Bart Plessers \(artabel\)

    Tom B Guest

    Do you mean on the client?

    In vbscript you'd do something like......


    <%
    Dim someValue

    someValue="XXXXX"

    %>

    <SCRIPT LANGUAGE=Javascript>
    function aFunction()
    {
    alert('<%=someValue%>');
    }
    </SCRIPT>



    "Bart Plessers (artabel)" <> wrote in message
    news:...
    > Hello,
    >
    > I want to have my function in jscript make use of the variables in an
    > asp-page.
    > How can I read the contents of a variable in the function (I don't want to
    > pass them as an argument)
    >
    > tia
    >
    > bartp
    >
    > --
    > HyperART
    > Paul Van Ostaijenlaan 4
    > 3001 Heverlee
    >
    >
    >
    Tom B, Sep 17, 2003
    #3
  4. exactly what I needed. thanx for helping me

    regards,

    bartp^


    --
    HyperART
    Paul Van Ostaijenlaan 4
    3001 Heverlee

    "Tom B" <> wrote in message
    news:...
    > Do you mean on the client?
    >
    > In vbscript you'd do something like......
    >
    >
    > <%
    > Dim someValue
    >
    > someValue="XXXXX"
    >
    > %>
    >
    > <SCRIPT LANGUAGE=Javascript>
    > function aFunction()
    > {
    > alert('<%=someValue%>');
    > }
    > </SCRIPT>
    >
    >
    >
    > "Bart Plessers (artabel)" <> wrote in message
    > news:...
    > > Hello,
    > >
    > > I want to have my function in jscript make use of the variables in an
    > > asp-page.
    > > How can I read the contents of a variable in the function (I don't want

    to
    > > pass them as an argument)
    > >
    > > tia
    > >
    > > bartp
    > >
    > > --
    > > HyperART
    > > Paul Van Ostaijenlaan 4
    > > 3001 Heverlee
    > >
    > >
    > >

    >
    >
    Bart Plessers \(artabel\), Sep 17, 2003
    #4
    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. Jon Maz
    Replies:
    4
    Views:
    1,248
    Jon Maz
    Sep 9, 2004
  2. Maxwell2006
    Replies:
    5
    Views:
    2,377
    Steven Cheng[MSFT]
    Mar 7, 2006
  3. Bryan Parkoff
    Replies:
    2
    Views:
    6,478
  4. John Bentley
    Replies:
    14
    Views:
    336
    Jim Ley
    Feb 5, 2004
  5. VK
    Replies:
    4
    Views:
    347
    Thomas 'PointedEars' Lahn
    Jan 12, 2006
Loading...

Share This Page