Skip to main content
Participating Frequently
August 19, 2016
Question

JavaScript Arithmetic Operators Syntax

  • August 19, 2016
  • 1 reply
  • 525 views

I am using Captivate 9 and executing a JavaScript from within an advanced action.

What is the correct syntax for comparing two variables in a conditional statement?

e.g To check equality I have successfully used the syntax..... if(x == y){

                                                                                                   var z = 1;

                                                                                                }

however when I try to check for the arithmetic operator ...."is less than", Captivate 9 will not allow me to  "update" the script....

e.g.           I tried.....      if(x < y){

                                        var z = y;

                                     }

I know that an advanced action script does not offer a "<" arithmetic operator Does that mean that  javascript that is executed within an advanced action, also will not allow the "is less than" arithmetic operation??

Thank you for your assistance.

    This topic has been closed for replies.

    1 reply

    TLCMediaDesign
    Inspiring
    August 19, 2016

    You can use less than in an advanced action.

    Certain characters can't be used in the JavaScript window. your best bet is to put the script in the html head or an external js file.

    X < Y is the same thing as Y > X though if it will allow you to use the greater than symbol.

    rockit_drAuthor
    Participating Frequently
    August 19, 2016

    Thank you.

    Lilybiri
    Legend
    August 20, 2016

    You do underestimate advanced/shared actions. Most logical parameters are available.