If Then statement

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shank

    If Then statement

    I'm coming from the ASP worl and have no clue to javascript. In the
    following code, I'm trying to set the value for variable strPage, then use
    that in the redirect statement. The page does nothing. No redirect at all.
    What should the synatx be?
    thanks!

    <SCRIPT LANGUAGE="JavaS cript">
    if Session("SoftHa rd") = "Hard"
    {
    strPage = "hardpage.asp?O rderNo=" & Session("OrderN o");
    }
    if Session("SoftHa rd") = "Soft"
    {
    strPage = "softpage.asp?O rderNo=" & Session("OrderN o");
    }
    setTimeout("top .location.href = strPage",4000);
    </SCRIPT>


  • artemis.alpeia

    #2
    Re: If Then statement

    Il Mon, 21 Jul 2003 21:35:08 GMT, "shank" <shank@tampabay .rr.com> ha
    scritto nel messaggio
    <g0ZSa.134377$i c1.2981995@twis ter.tampabay.rr .com>:
    [color=blue]
    > I'm coming from the ASP worl and have no clue to javascript. In the
    > following code, I'm trying to set the value for variable strPage, then use
    > that in the redirect statement. The page does nothing. No redirect at all.
    > What should the synatx be?
    > thanks!
    >
    > <SCRIPT LANGUAGE="JavaS cript">
    > if Session("SoftHa rd") = "Hard"
    > {
    > strPage = "hardpage.asp?O rderNo=" & Session("OrderN o");
    > }
    > if Session("SoftHa rd") = "Soft"
    > {
    > strPage = "softpage.asp?O rderNo=" & Session("OrderN o");
    > }
    > setTimeout("top .location.href = strPage",4000);
    > </SCRIPT>[/color]

    I guess Session is a function of yours :/

    the if statement requires parenthesis to include the boolean
    condition.

    furthermore, to verify an equality you must use a double equal (==).

    if (Session("SoftH ard") == "Hard")
    {
    // blah blah
    }
    else if (Session("SoftH ard") == "Soft")
    {
    // blah blah
    }


    --
    artemis.alpeia

    Comment

    • Lasse Reichstein Nielsen

      #3
      Re: If Then statement

      "shank" <shank@tampabay .rr.com> writes:
      [color=blue]
      > I'm coming from the ASP worl and have no clue to javascript.[/color]

      Javascript syntax is derived from C syntax, just like C++, Java, C#,
      and a lot of other languages. The short version is:

      - case sensitive!
      - conditional and loop statements are:
      if ( <expr> ) <stmt> [ else <stmt> ]
      while ( <expr> ) <stmt>
      do <stmt> while ( <expr> )
      for (<expr> ; <expr> ; <expr>) <stmt>
      where parentheses are needed (but [ ] just means "optional")
      - statements are ended with semicolon, or grouped with "{" and "}"
      - comparison is "==", while "=" is assignment.
      - local variables are declared with "var" in front.

      I don't know of any tutorials on Javascript that I can recommend, but
      I am sure you can find a lot by entering "javascript tutorial" into
      Google. Just be careful, they are not all good.
      [color=blue]
      > In the following code, I'm trying to set the value for variable
      > strPage, then use that in the redirect statement. The page does
      > nothing. No redirect at all. What should the synatx be? thanks![/color]

      If you used a browser capable of giving useful error messages (that
      is, anythin but IE), then you would probably be told where the syntax
      errors are. Even IE's error messages are better than nothing, and will
      at least tell you what line the error is on.
      [color=blue]
      > <SCRIPT LANGUAGE="JavaS cript">[/color]

      should be
      <script type="text/javascript">
      The language attribute is deprecated and the type attribute is mandatory
      in HTML 4.
      [color=blue]
      > if Session("SoftHa rd") = "Hard"[/color]

      Should be
      if (Session("SoftH ard") == "Hard")
      Comparison is "==", where "=" is assignment.
      [color=blue]
      > {
      > strPage = "hardpage.asp?O rderNo=" & Session("OrderN o");[/color]

      should be
      strPage = "hardpage.asp?O rderNo=" + Session("OrderN o");
      The string concatenation operator is "+".
      [color=blue]
      > }
      > if Session("SoftHa rd") = "Soft"[/color]

      could be changed into just
      else
      if Session("SoftHa rd") only has two results.
      [color=blue]
      > {
      > strPage = "softpage.asp?O rderNo=" & Session("OrderN o");[/color]

      String concatenation again.


      /L
      --
      Lasse Reichstein Nielsen - lrn@hotpop.com
      Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
      'Faith without judgement merely degrades the spirit divine.'

      Comment

      • shank

        #4
        Re: If Then statement

        Thanks, but still not redirecting. Using your example I have the following.
        I'm assuming in lieu of // blah blah, my statements were correct. I'm
        guessing that my problem is implementing my Session variables
        (Session("Order No")"into the mix. Any thoughts?
        thanks!

        <SCRIPT LANGUAGE="JavaS cript">
        if (Session("SoftH ard") == "Hard")
        {
        strPage = "hardpage.asp?O rderNo=" & Session("OrderN o");
        }
        else if (Session("SoftH ard") == "Soft")
        {
        strPage = "softpage.asp?O rderNo=" & Session("OrderN o");
        }
        setTimeout("top .location.href = strPage",1000);
        </SCRIPT>

        "artemis.alpeia " <it.inwind@alpe ia.artemis> wrote in message
        news:5lnohvc5n2 p4kntf62re60ron prg6f92hv@4ax.c om...[color=blue]
        > Il Mon, 21 Jul 2003 21:35:08 GMT, "shank" <shank@tampabay .rr.com> ha
        > scritto nel messaggio
        > <g0ZSa.134377$i c1.2981995@twis ter.tampabay.rr .com>:
        >[color=green]
        > > I'm coming from the ASP worl and have no clue to javascript. In the
        > > following code, I'm trying to set the value for variable strPage, then[/color][/color]
        use[color=blue][color=green]
        > > that in the redirect statement. The page does nothing. No redirect at[/color][/color]
        all.[color=blue][color=green]
        > > What should the synatx be?
        > > thanks!
        > >
        > > <SCRIPT LANGUAGE="JavaS cript">
        > > if Session("SoftHa rd") = "Hard"
        > > {
        > > strPage = "hardpage.asp?O rderNo=" & Session("OrderN o");
        > > }
        > > if Session("SoftHa rd") = "Soft"
        > > {
        > > strPage = "softpage.asp?O rderNo=" & Session("OrderN o");
        > > }
        > > setTimeout("top .location.href = strPage",4000);
        > > </SCRIPT>[/color]
        >
        > I guess Session is a function of yours :/
        >
        > the if statement requires parenthesis to include the boolean
        > condition.
        >
        > furthermore, to verify an equality you must use a double equal (==).
        >
        > if (Session("SoftH ard") == "Hard")
        > {
        > // blah blah
        > }
        > else if (Session("SoftH ard") == "Soft")
        > {
        > // blah blah
        > }
        >
        >
        > --
        > artemis.alpeia
        >[/color]


        Comment

        • shank

          #5
          Re: If Then statement

          Still not getting it right. Am I incorporating my Session("OrderN o")
          variable correctly?
          thanks!

          <SCRIPT LANGUAGE="JavaS cript">
          if (Session("SoftH ard") == "Hard")
          {
          var strPage = "hardpage.asp?O rderNo=" var Session("OrderN o");
          }
          else if (Session("SoftH ard") == "Soft")
          {
          var strPage = "softpage.asp?O rderNo=" var Session("OrderN o");
          }
          setTimeout("top .location.href = var strPage",1000);
          </SCRIPT>

          "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
          news:3cgzy0zn.f sf@hotpop.com.. .[color=blue]
          > "shank" <shank@tampabay .rr.com> writes:
          >[color=green]
          > > I'm coming from the ASP worl and have no clue to javascript.[/color]
          >
          > Javascript syntax is derived from C syntax, just like C++, Java, C#,
          > and a lot of other languages. The short version is:
          >
          > - case sensitive!
          > - conditional and loop statements are:
          > if ( <expr> ) <stmt> [ else <stmt> ]
          > while ( <expr> ) <stmt>
          > do <stmt> while ( <expr> )
          > for (<expr> ; <expr> ; <expr>) <stmt>
          > where parentheses are needed (but [ ] just means "optional")
          > - statements are ended with semicolon, or grouped with "{" and "}"
          > - comparison is "==", while "=" is assignment.
          > - local variables are declared with "var" in front.
          >
          > I don't know of any tutorials on Javascript that I can recommend, but
          > I am sure you can find a lot by entering "javascript tutorial" into
          > Google. Just be careful, they are not all good.
          >[color=green]
          > > In the following code, I'm trying to set the value for variable
          > > strPage, then use that in the redirect statement. The page does
          > > nothing. No redirect at all. What should the synatx be? thanks![/color]
          >
          > If you used a browser capable of giving useful error messages (that
          > is, anythin but IE), then you would probably be told where the syntax
          > errors are. Even IE's error messages are better than nothing, and will
          > at least tell you what line the error is on.
          >[color=green]
          > > <SCRIPT LANGUAGE="JavaS cript">[/color]
          >
          > should be
          > <script type="text/javascript">
          > The language attribute is deprecated and the type attribute is mandatory
          > in HTML 4.
          >[color=green]
          > > if Session("SoftHa rd") = "Hard"[/color]
          >
          > Should be
          > if (Session("SoftH ard") == "Hard")
          > Comparison is "==", where "=" is assignment.
          >[color=green]
          > > {
          > > strPage = "hardpage.asp?O rderNo=" & Session("OrderN o");[/color]
          >
          > should be
          > strPage = "hardpage.asp?O rderNo=" + Session("OrderN o");
          > The string concatenation operator is "+".
          >[color=green]
          > > }
          > > if Session("SoftHa rd") = "Soft"[/color]
          >
          > could be changed into just
          > else
          > if Session("SoftHa rd") only has two results.
          >[color=green]
          > > {
          > > strPage = "softpage.asp?O rderNo=" & Session("OrderN o");[/color]
          >
          > String concatenation again.
          >
          >
          > /L
          > --
          > Lasse Reichstein Nielsen - lrn@hotpop.com
          > Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
          > 'Faith without judgement merely degrades the spirit divine.'
          >[/color]


          Comment

          • Douglas Crockford

            #6
            Re: If Then statement

            > I'm coming from the ASP worl and have no clue to javascript. In the[color=blue]
            > following code, I'm trying to set the value for variable strPage, then use
            > that in the redirect statement. The page does nothing. No redirect at all.
            > What should the synatx be?[/color]

            There's nothing like knowing what you are doing. I recommend that you get a good
            book and try to develop some competence in the subject. Flanagan's book is the
            best available. Check the FAQ.



            Comment

            • Richard Cornford

              #7
              Re: If Then statement

              "shank" <shank@tampabay .rr.com> wrote in message
              news:DO%Sa.1356 03$ic1.3004722@ twister.tampaba y.rr.com...[color=blue]
              > Still not getting it right. Am I incorporating my
              >Session("Order No") variable correctly?[/color]
              <snip>[color=blue]
              > var strPage = "softpage.asp?O rderNo=" var Session("OrderN o");[/color]
              <snip>

              Probably not! You have not shown us your - Session - function but if it
              returns a string (or a number) then you would want to concatenate it to
              the URL string. The JavaScript concatenation operator is + (the plus
              symbol, and it also performs numeric addition, but if either operand is
              a string it performs concatenation (with automatic type conversion to
              string if one operand is not a string)):-

              var strPage = "softpage.asp?O rderNo=" + Session("OrderN o");

              The - var - keyword is a syntax error in the context in which you used
              it just before the Session function call. var - declares a variable and
              should be followed by a valid identifier (and possibly an assignment
              operation) or a comma separated list of identifiers with optional
              assignments:-

              var a;
              var b = 'anyString';
              var c, d, e = 24, f, g = new Object();

              However, I suspect that what appears to be a function called - Session -
              is actually the cause of your problems and represents a misconception
              caused by your server-side experience with built in Session objects in
              ASP. I may be wrong, in any event it would be useful if you would show
              the function definition (if one exists) or explain what role Session is
              expected to play in this code.

              Richard.


              Comment

              • Trevor Hills

                #8
                Re: If Then statement

                shank wrote:[color=blue]
                > I'm coming from the ASP worl and have no clue to javascript.[/color]

                Mate, you've got some reading to do:


                Using Mozilla in testing and debugging web sites. Described here are some very cool features in Mozilla which will enable you to quickly find and debug errors in your web site and web applications


                Comment

                • Tim Slattery

                  #9
                  Re: If Then statement

                  "shank" <shank@tampabay .rr.com> wrote:
                  [color=blue]
                  >I'm coming from the ASP worl and have no clue to javascript. In the
                  >following code, I'm trying to set the value for variable strPage, then use
                  >that in the redirect statement. The page does nothing. No redirect at all.
                  >What should the synatx be?
                  >thanks!
                  >
                  ><SCRIPT LANGUAGE="JavaS cript">
                  >if Session("SoftHa rd") = "Hard"[/color]

                  Use a double equal sign for comparison: if Session("SoftHa rd") ==
                  "Hard". Single equal sign is only for assignment.[color=blue]
                  >{
                  >strPage = "hardpage.asp?O rderNo=" & Session("OrderN o");[/color]

                  If you're trying to concatenate these things, use "+".[color=blue]
                  >}
                  >if Session("SoftHa rd") = "Soft"[/color]

                  Again, double equal sign for comparison
                  [color=blue]
                  >{
                  >strPage = "softpage.asp?O rderNo=" & Session("OrderN o");[/color]

                  And a + sign for concatenation[color=blue]
                  >}
                  > setTimeout("top .location.href = strPage",4000);
                  ></SCRIPT>
                  >[/color]


                  --
                  Tim Slattery
                  Slattery_T@bls. gov

                  Comment

                  • Steven Dilley

                    #10
                    Re: If Then statement

                    "shank" <shank@tampabay .rr.com> wrote in message
                    news:g0ZSa.1343 77$ic1.2981995@ twister.tampaba y.rr.com...[color=blue]
                    > I'm coming from the ASP worl and have no clue to javascript. In the
                    > following code, I'm trying to set the value for variable strPage, then use
                    > that in the redirect statement. The page does nothing. No redirect at all.
                    > What should the synatx be?
                    > thanks!
                    >
                    > <SCRIPT LANGUAGE="JavaS cript">
                    > if Session("SoftHa rd") = "Hard"
                    > {
                    > strPage = "hardpage.asp?O rderNo=" & Session("OrderN o");
                    > }
                    > if Session("SoftHa rd") = "Soft"
                    > {
                    > strPage = "softpage.asp?O rderNo=" & Session("OrderN o");
                    > }
                    > setTimeout("top .location.href = strPage",4000);
                    > </SCRIPT>
                    >[/color]
                    Is this a server script or a client script? Sessions are a server concept,
                    but redirection only works on the client side.

                    Have you considered learning vbscript first?

                    Comment

                    • shank

                      #11
                      Re: If Then statement

                      I am in fact trying to incorporate a server side variable. There must be
                      some way to bring that variable locally so it can be used... isn't there?
                      thanks!

                      "Steven Dilley" <steven.dilley@ compuware.com> wrote in message
                      news:3f1d55c1@1 0.10.0.241...[color=blue]
                      > "shank" <shank@tampabay .rr.com> wrote in message
                      > news:g0ZSa.1343 77$ic1.2981995@ twister.tampaba y.rr.com...[color=green]
                      > > I'm coming from the ASP worl and have no clue to javascript. In the
                      > > following code, I'm trying to set the value for variable strPage, then[/color][/color]
                      use[color=blue][color=green]
                      > > that in the redirect statement. The page does nothing. No redirect at[/color][/color]
                      all.[color=blue][color=green]
                      > > What should the synatx be?
                      > > thanks!
                      > >
                      > > <SCRIPT LANGUAGE="JavaS cript">
                      > > if Session("SoftHa rd") = "Hard"
                      > > {
                      > > strPage = "hardpage.asp?O rderNo=" & Session("OrderN o");
                      > > }
                      > > if Session("SoftHa rd") = "Soft"
                      > > {
                      > > strPage = "softpage.asp?O rderNo=" & Session("OrderN o");
                      > > }
                      > > setTimeout("top .location.href = strPage",4000);
                      > > </SCRIPT>
                      > >[/color]
                      > Is this a server script or a client script? Sessions are a server[/color]
                      concept,[color=blue]
                      > but redirection only works on the client side.
                      >
                      > Have you considered learning vbscript first?
                      >
                      >[/color]


                      Comment

                      • shank

                        #12
                        Re: If Then statement

                        I'm trying to assemble all the suggestions and I'm still not getting a
                        redirect to happen.
                        To simplify matters, I'm using 2 variables.
                        Any help is appreciated!!!
                        thanks!

                        <SCRIPT LANGUAGE="JavaS cript">
                        var SoftHard == <%=Session("Sof tHard")%>
                        var OrderNo == <%=Session("Ord erNo")%>
                        if SoftHard = "Hard")
                        {
                        strPage = "hardpage.asp?O rderNo=" + OrderNo;
                        }
                        else if SoftHard = "Soft")
                        {
                        strPage = "softpage.asp?O rderNo=" + OrderNo;
                        }
                        setTimeout("top .location.href = " + strPage,1000);
                        </SCRIPT>


                        "Tim Slattery" <Slattery_T@bls .gov> wrote in message
                        news:b9rqhv0mkr jcvko0a0s239dm3 udvglmkfu@4ax.c om...[color=blue]
                        > "shank" <shank@tampabay .rr.com> wrote:
                        >[color=green]
                        > >I am in fact trying to incorporate a server side variable. There must be
                        > >some way to bring that variable locally so it can be used... isn't there?
                        > >thanks![/color]
                        >
                        > Not directly. You'll have to write the value of the server-side
                        > variable into the client-side script. Something like this:
                        >
                        > <SCRIPT LANGUAGE="JavaS cript">
                        > if ("<%=Session("S oftHard")%>" == "Hard")
                        > {
                        > /* whatever */
                        > .
                        > .
                        > .
                        >
                        > The value of the Session variable "SoftHard" is written to the client
                        > as part of the client-side JavaScript code. The client sees this
                        > (assuming the value of SoftHard is "Soft"):
                        >
                        > <SCRIPT LANGUAGE="JavaS cript">
                        > if ("Soft" == "Hard")
                        > {
                        > /* whatever */
                        > .
                        > .
                        > .
                        >
                        > --
                        > Tim Slattery
                        > Slattery_T@bls. gov
                        >[/color]


                        Comment

                        • Richard Cornford

                          #13
                          Re: If Then statement

                          "shank" <shank@tampabay .rr.com> wrote in message
                          news:hLhTa.23$B B6.8149@twister .tampabay.rr.co m...[color=blue]
                          > I'm trying to assemble all the suggestions and I'm still not getting a
                          > redirect to happen.
                          > To simplify matters, I'm using 2 variables.
                          > Any help is appreciated!!!
                          > thanks!
                          >
                          > <SCRIPT LANGUAGE="JavaS cript">[/color]

                          The language attribute if deprecated in favour of type.

                          <script type="text/javascript">
                          [color=blue]
                          > var SoftHard == <%=Session("Sof tHard")%>[/color]

                          This should be an assignment (single equals sign) not an equality test
                          (double equals sign). If the value written into the script from the
                          Session object is a string then it should be quoted in the JavaScript
                          source:-

                          var SoftHard = "<%=Session("So ftHard")%>";
                          [color=blue]
                          > var OrderNo == <%=Session("Ord erNo")%>[/color]

                          Ditto:-

                          var OrderNo = "<%=Session("Or derNo")%>";
                          [color=blue]
                          > if SoftHard = "Hard")[/color]

                          Missing opening parenthesis and the if statement's expression should not
                          be an assignment (single equals sign) it should be a test for equality
                          (double (or triple) equals sign):-

                          if(SoftHard == "Hard")
                          [color=blue]
                          > {
                          > strPage = "hardpage.asp?O rderNo=" + OrderNo;
                          > }
                          > else if SoftHard = "Soft")[/color]

                          Ditto:-

                          else if(SoftHard == "Soft")
                          [color=blue]
                          > {
                          > strPage = "softpage.asp?O rderNo=" + OrderNo;
                          > }
                          > setTimeout("top .location.href = " + strPage,1000);
                          > </SCRIPT>[/color]

                          I can't see any reason for doing this test on the client at all. I don't
                          know ASP but, guessing at the syntax, what would be wrong with something
                          like (note: this will line wrap)? :-

                          <script type="text/javascript">
                          setTimeout("top .location = \"<%=( (Session("SoftH ard") ==
                          "Soft")?"softpa ge.asp":"hardpa ge.asp")%>?Orde rNo=<%=Session( "OrderNo")% >
                          \";", 1000);
                          </script>

                          Richard.


                          Comment

                          • shank

                            #14
                            Re: If Then statement


                            "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
                            news:y8yqtf41.f sf@hotpop.com.. .[color=blue]
                            > "shank" <shank@tampabay .rr.com> writes:
                            >[color=green]
                            > > I'm trying to assemble all the suggestions and I'm still not getting a
                            > > redirect to happen.
                            > > To simplify matters, I'm using 2 variables.
                            > > Any help is appreciated!!!
                            > >
                            > > <SCRIPT LANGUAGE="JavaS cript">[/color]
                            >
                            > Should be
                            > <script type="text/javascript">
                            >
                            > The type attribute is mandatory, and the language attribute is deprecated.
                            >[color=green]
                            > > var SoftHard == <%=Session("Sof tHard")%>[/color]
                            >
                            > Should be:
                            > var SoftHard = "<%=Session("So ftHard")%>";
                            >
                            > Assignment is single "=".
                            > (I assume the Session function returns a string that is inserted
                            > unquoted, so I added quotes.)
                            >[color=green]
                            > > var OrderNo == <%=Session("Ord erNo")%>[/color]
                            >
                            > var OrderNo = <%=Session("Ord erNo")%>;
                            >
                            > (I assumed it was a number, so it didn't need quotes).
                            >[color=green]
                            > > if SoftHard = "Hard")[/color]
                            >
                            > should be:
                            > if (SoftHard == "Hard")
                            >
                            > Comparison is double "="
                            >[color=green]
                            > > {
                            > > strPage = "hardpage.asp?O rderNo=" + OrderNo;
                            > > }
                            > > else if SoftHard = "Soft")[/color]
                            >
                            > Should be:
                            > else if (SoftHard == "Soft")
                            > or just
                            > else
                            > (what else could it be?)
                            >[color=green]
                            > > {
                            > > strPage = "softpage.asp?O rderNo=" + OrderNo;
                            > > }
                            > > setTimeout("top .location.href = " + strPage,1000);
                            > > </SCRIPT>[/color]
                            >
                            > Please don't top post (answering above the message you reply to and
                            > including it unedited below).
                            >
                            > /L
                            > --
                            > Lasse Reichstein Nielsen - lrn@hotpop.com
                            > Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
                            > 'Faith without judgement merely degrades the spirit divine.'[/color]
                            ------------------------------------
                            I've added some comments below. Maybe that will help. The help is
                            outstanding in this group, but I'm still not getting it. In my browser
                            status bar I get "Done with errors" and of course - no redirect. I changed
                            one of the variables var OrderNo to OrdNo thinking that maybe that was
                            messing up the syntax. I'm using OrderNo in the URL string. Any help is
                            appreciated!!!

                            <script type="text/javascript">
                            //Assign 2 variables. Both variables are text
                            var SoftHard = "<%=Session("So ftHard")%>";
                            var OrdNo = "<%=Session("Or derNo")%>";
                            //If SoftHard = Hard then show hardware page
                            if(SoftHard == "Hard")
                            {
                            //Assemble URL for use below
                            strPage = "hardpage.asp?O rderNo=" + OrdNo; //<--- is this the proper way to
                            assemble a string
                            }
                            //If SoftHard = Soft then show software page
                            else if(SoftHard == "Soft")
                            //Assemble URL for use below
                            {
                            strPage = "softpage.asp?O rderNo=" + OrdNo; //<--- is this the proper way to
                            assemble a string
                            }
                            //Provide url to get customer back to product page
                            setTimeout("top .location.href =" + strPage,1000); //<--- is this the proper
                            way to assemble a string
                            </script>


                            Comment

                            • Tim Slattery

                              #15
                              Re: If Then statement

                              "shank" <shank@tampabay .rr.com> wrote:
                              [color=blue]
                              >I'm trying to assemble all the suggestions and I'm still not getting a
                              >redirect to happen.
                              >To simplify matters, I'm using 2 variables.
                              >Any help is appreciated!!!
                              >thanks![/color]

                              Two equal signs for comparison, one for assignment! And "if"
                              statements always have to have the logical expression surrounded by
                              parens.
                              [color=blue]
                              ><SCRIPT LANGUAGE="JavaS cript">
                              >var SoftHard == <%=Session("Sof tHard")%>[/color]

                              var SoftHard = "<%=Session("So ftHard")%>"
                              [color=blue]
                              >var OrderNo == <%=Session("Ord erNo")%>[/color]

                              var OrderNo = "<%=Session("Or derNo")%>"
                              [color=blue]
                              >if SoftHard = "Hard")[/color]

                              if (SoftHard == "Hard")
                              [color=blue]
                              >{
                              >strPage = "hardpage.asp?O rderNo=" + OrderNo;
                              >}
                              >else if SoftHard = "Soft")[/color]

                              else if (SoftHard == "Soft")
                              [color=blue]
                              >{
                              >strPage = "softpage.asp?O rderNo=" + OrderNo;
                              >}
                              > setTimeout("top .location.href = " + strPage,1000);
                              ></SCRIPT>
                              >
                              >
                              >"Tim Slattery" <Slattery_T@bls .gov> wrote in message
                              >news:b9rqhv0mk rjcvko0a0s239dm 3udvglmkfu@4ax. com...[color=green]
                              >> "shank" <shank@tampabay .rr.com> wrote:
                              >>[color=darkred]
                              >> >I am in fact trying to incorporate a server side variable. There must be
                              >> >some way to bring that variable locally so it can be used... isn't there?
                              >> >thanks![/color]
                              >>
                              >> Not directly. You'll have to write the value of the server-side
                              >> variable into the client-side script. Something like this:
                              >>
                              >> <SCRIPT LANGUAGE="JavaS cript">
                              >> if ("<%=Session("S oftHard")%>" == "Hard")
                              >> {
                              >> /* whatever */
                              >> .
                              >> .
                              >> .
                              >>
                              >> The value of the Session variable "SoftHard" is written to the client
                              >> as part of the client-side JavaScript code. The client sees this
                              >> (assuming the value of SoftHard is "Soft"):
                              >>
                              >> <SCRIPT LANGUAGE="JavaS cript">
                              >> if ("Soft" == "Hard")
                              >> {
                              >> /* whatever */
                              >> .
                              >> .
                              >> .
                              >>
                              >> --
                              >> Tim Slattery
                              >> Slattery_T@bls. gov
                              >>[/color]
                              >[/color]


                              --
                              Tim Slattery
                              Slattery_T@bls. gov

                              Comment

                              Working...