OT: Javascript for an ASP guy?

Discussion in 'ASP General' started by Byron, Mar 2, 2005.

  1. Byron

    Byron Guest

    Hey,

    I'm pretty good with ASP but Javascript has always confused me so I tend
    to use pre-built stuff that I can just plug-in and only tweak if
    absolutely necessary.

    I'm working on something now that needs to client side dynamism and I
    know how I'd do it with with ASP, but I'm sure if Javascript can do
    this, or where to look.

    Can you, with Javascript, set a variable to a specific value on an
    onClick action, and have an if...then in another spot on the page check
    the value of that variable and if it meets the right condition toggle
    between images?

    Seems like you should be able to, but I'm often wrong.
    Byron, Mar 2, 2005
    #1
    1. Advertising

  2. Byron

    MarkP Guest

    Yes you can. Make sure that the variable is declared in the HEAD section (in
    script tags of course), that way it acts like a local variable (global to the
    file).

    You can then reference that variable elsewhere.
    MarkP, Mar 2, 2005
    #2
    1. Advertising

  3. Byron

    Byron Guest

    In article <>,
    says...
    > Yes you can. Make sure that the variable is declared in the HEAD section (in
    > script tags of course), that way it acts like a local variable (global to the
    > file).
    >
    > You can then reference that variable elsewhere.
    >


    Is this considered "Setting a cookie?" That's what I find tutorials on
    when I google it.
    Byron, Mar 2, 2005
    #3
  4. Byron

    Evertjan. Guest

    Byron wrote on 02 mrt 2005 in microsoft.public.inetserver.asp.general:

    > I'm pretty good with ASP but Javascript has always confused me so I tend
    > to use pre-built stuff that I can just plug-in and only tweak if
    > absolutely necessary.
    >
    > I'm working on something now that needs to client side dynamism and I
    > know how I'd do it with with ASP, but I'm sure if Javascript can do
    > this, or where to look.
    >


    <script language=javascript runat=server>
    response.write('Do you think Javascript means clientside');
    response.write(' and so is off topic in asp?<br><br>');
    response.write('Do you think ASP-guy equals vbscript-guy?');
    </script>

    if your answer is yes then
    please reconsider
    end if

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Mar 2, 2005
    #4
  5. Byron

    Byron Guest

    In article <Xns960D5FD9D4881eejj99@194.109.133.29>,
    says...
    > Byron wrote on 02 mrt 2005 in microsoft.public.inetserver.asp.general:
    >
    > > I'm pretty good with ASP but Javascript has always confused me so I tend
    > > to use pre-built stuff that I can just plug-in and only tweak if
    > > absolutely necessary.
    > >
    > > I'm working on something now that needs to client side dynamism and I
    > > know how I'd do it with with ASP, but I'm sure if Javascript can do
    > > this, or where to look.
    > >

    >
    > <script language=javascript runat=server>
    > response.write('Do you think Javascript means clientside');
    > response.write(' and so is off topic in asp?<br><br>');
    > response.write('Do you think ASP-guy equals vbscript-guy?');
    > </script>
    >
    > if your answer is yes then
    > please reconsider
    > end if
    >
    >


    How clever. I said it was off topic. Thanks.
    Byron, Mar 2, 2005
    #5
  6. Byron

    Evertjan. Guest

    Byron wrote on 02 mrt 2005 in microsoft.public.inetserver.asp.general:
    >>
    >> <script language=javascript runat=server>
    >> response.write('Do you think Javascript means clientside');
    >> response.write(' and so is off topic in asp?<br><br>');
    >> response.write('Do you think ASP-guy equals vbscript-guy?');
    >> </script>
    >>
    >> if your answer is yes then
    >> please reconsider
    >> end if
    >>

    > How clever. I said it was off topic. Thanks.


    Cleverness aside, if that means "yes", then you clearly don't know that
    many ASP-guys code preferably in serverside javascript/jscript.

    But why, if I may ask, do you ask a clearly clientside javascript question
    as OT in this ASP NG and not in one of the javascript or jscript NGs.

    Is that because you are an ASP-guy? That wouldn't sound like a valid
    reason.

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Mar 2, 2005
    #6
  7. Byron wrote:
    > In article <>,
    > says...
    >> Yes you can. Make sure that the variable is declared in the HEAD
    >> section (in script tags of course), that way it acts like a local
    >> variable (global to the file).


    While it is preferable to declare all global variables in a single location.
    it is not necessary. The only requirement is that they be declared (inside
    of a script block) outside of a function.
    <head></head>
    <body>
    <script>
    var globvar = 25
    .....


    globvar can be accessed by other scripts in this page.


    >>
    >> You can then reference that variable elsewhere.
    >>

    >
    > Is this considered "Setting a cookie?" That's what I find tutorials on
    > when I google it.


    No. That is much different. This is called "setting a variable", i.e.,
    setting aside a location in memory to contain a value that can be referenced
    later by code running in the same scope. Cookies are written to the client's
    disk, and therefore can be referenced by more than one page. Variables are
    in memory, and are destroyed when they go out of scope.

    Byron, client-side questions (whether vbscript or javascript) should be
    posted in one of the .scripting groups, either .scripting.jscript, or
    ..scripting.vbscript if you want an IE-only solution.

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Mar 2, 2005
    #7
    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. Replies:
    2
    Views:
    473
  2. Macon Joe Job Guy Joe Macon Job Guy

    Att: Macon Joe Job Guy Joe Macon Job Guy Macon

    Macon Joe Job Guy Joe Macon Job Guy, Oct 14, 2007, in forum: Java
    Replies:
    0
    Views:
    369
    Macon Joe Job Guy Joe Macon Job Guy
    Oct 14, 2007
  3. Lee Marsh

    PHP guy turned ASP needs pointers

    Lee Marsh, Jun 17, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    182
    Ken Cox [Microsoft MVP]
    Jun 18, 2005
  4. Replies:
    1
    Views:
    209
    Rectal Mania
    Aug 6, 2007
  5. chrisdude911

    New guy to javascript needs help!

    chrisdude911, Apr 26, 2006, in forum: Javascript
    Replies:
    3
    Views:
    70
    Evertjan.
    Apr 26, 2006
Loading...

Share This Page