If Then statement

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

    #16
    Re: If Then statement

    "shank" <shank@tampabay .rr.com> wrote:
    [color=blue][color=green]
    >> Two equal signs for comparison, one for assignment! And "if"
    >> statements always have to have the logical expression surrounded by
    >> parens.[/color][/color]

    Yup, looks fine now.

    --
    Tim Slattery
    Slattery_T@bls. gov

    Comment

    • shank

      #17
      Re: If Then statement

      That's the problem. Still does nothing except show "error on the page" in
      the status bar.

      Am I correct in thinking that this code can go at the bottom of my page?
      thanks

      "Tim Slattery" <Slattery_T@bls .gov> wrote in message
      news:ekethvs3h3 e73b04elgvbmpc2 nfjt82s4f@4ax.c om...[color=blue]
      > "shank" <shank@tampabay .rr.com> wrote:
      >[color=green][color=darkred]
      > >> Two equal signs for comparison, one for assignment! And "if"
      > >> statements always have to have the logical expression surrounded by
      > >> parens.[/color][/color]
      >
      > Yup, looks fine now.
      >
      > --
      > Tim Slattery
      > Slattery_T@bls. gov
      >[/color]


      Comment

      • Richard Cornford

        #18
        Re: If Then statement

        "shank" <shank@tampabay .rr.com> wrote in message
        news:zXkTa.280$ BB6.31776@twist er.tampabay.rr. com...
        <snip>[color=blue]
        >setTimeout("to p.location.href =" + strPage,1000);[/color]
        <snip>

        The setTimeout function, when a string argument is its first parameter,
        takes a string of JavaScript source code and executes it (approximately)
        after the number of milliseconds specified as its second argument.

        The code that you want to execute is along the lines of:-

        top.location = "stringOfSelect edPage.asp?name =value";

        Notice that the value being assigned (right had side of the assignment
        operator - = -) is a string; it is surrounded with quote marks.

        To pass this line of code to setTimeout the entire line must be
        represented as a string. You cannot re-use the double quotes around the
        entire string and use then inside the string unless the quotes inside
        the string are escaped:-

        "top.locati on = \"stringOfSelec tedPage.asp?nam e=value\";"

        - Alternatively single quotes may be used around a string that wants to
        treat double quotes literally (or vice versa):-

        "top.locati on = 'stringOfSelect edPage.asp?name =value';"
        - or -
        'top.location = "stringOfSelect edPage.asp?name =value";'

        Now you want to build this string using the - strPage - variable instead
        of the URL, it still needs to appear as a quoted string in the
        JavaScript code that is the result of the concatenation:-

        "top.locati on = \""+ strPage +"\";"

        So the setTimeout call becomes:-

        setTimeout( ("top.locati on = \""+ strPage +"\";"), 1000);

        But I still cannot see any reason for doing this on the client as the
        server script has all of the information needed to make the decision, so
        it only need write out the setTimeout line (and it could write a meta
        refresh tag as an alternative to using JavaScript at all).

        Richard.


        Comment

        Working...