Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

JavaScript Script_Window

New Here ,
Aug 11, 2015 Aug 11, 2015

In the JavaScript Script_Window I'm trying to do something like this:

     var color = "00FF00";

     window.cpAPIInterface.setVariableValue("link", "<font color='#" + color + "'><u>Test</u></font>");

Using a button, On Success -> Execute JavaScript, I can use the sample script with no issues. But when I Execute Advanced Actions that contains an action to Execute JavaScript, the sample script breaks. In the Advanced Actions, the sample script is changed every time I try to Update Action. Whenever I'm debugging in browser I get an "Unterminated string constant" error. I have tried escaping the single quote with a slash, but it still doesn't work. Is this just a "feature" of Captivate? I need to do other actions so I need to make it work in an Advanced Action.

201
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Aug 12, 2015 Aug 12, 2015
LATEST

I would put your script in an external function and call that function in the advanced action JS window.

I execute all of my JS in and external js file. There are too many limitations in the Captivate js window.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources