Skip to main content
rugagu
Participant
August 11, 2015
Question

JavaScript Script_Window

  • August 11, 2015
  • 1 reply
  • 214 views

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.

    This topic has been closed for replies.

    1 reply

    TLCMediaDesign
    Inspiring
    August 12, 2015

    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.