Skip to main content
Participating Frequently
Aug 19, 2016 5:58 PM UTC
Question

JavaScript Arithmetic Operators Syntax

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 is closed to new replies. Start a new post to keep the conversation going.

    5 replies

    TLCMediaDesign
    Inspiring
    Aug 19, 2016 6:12 PM UTC

    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.

    Translate
    rockit_drAuthor
    Participating Frequently
    Aug 19, 2016 6:21 PM UTC

    Thank you.

    Translate
    Lilybiri
    Legend
    Aug 20, 2016 1:42 PM UTC

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

    Translate