Highlighted

JavaScript Arithmetic Operators Syntax

New Here ,
Aug 19, 2016

Copy link to clipboard

Copied

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.

Views

217

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

JavaScript Arithmetic Operators Syntax

New Here ,
Aug 19, 2016

Copy link to clipboard

Copied

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.

Views

218

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 19, 2016 0
Adobe Community Professional ,
Aug 19, 2016

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 19, 2016 0
New Here ,
Aug 19, 2016

Copy link to clipboard

Copied

Thank you.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 19, 2016 0
Most Valuable Participant ,
Aug 20, 2016

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 20, 2016 0
New Here ,
Sep 24, 2019

Copy link to clipboard

Copied

Thanks for confirming what I realized, after chasing my tail for an hour, must be yet another Captivate bug. The inability to recognize the < symbol is just another example of why Captivate is an inferior product.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 24, 2019 0
Gaanf LATEST
Engaged ,
Sep 24, 2019

Copy link to clipboard

Copied

Some work around: write out the code in an external editor first, then replace < by &lt (HTML Number for '<') or &#60 (HTML Name for '<') before copying code to the Script Window in an Advanced Action. On saving the Script Window, those strings will be properly escaped and converted to the '<' character. Note that you'll have to cover all '<' character occurrences in the code at once in every copy and past action. You can't just edit/add one of several occurrences that way, so it's probably good advise to always copy the entire code to a blank Script Window in one shot. You can also type the HTML Number/Name strings directly into the Script Window, but again you'd have to make sure to enter all occurrences in one shot. See https://forums.adobe.com/message/10709838

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 24, 2019 0