Skip to main content
Inspiring
August 31, 2016
Question

How to output JS generated text to Captivate slide?

  • August 31, 2016
  • 2 replies
  • 596 views

I wrote some custom Javascript that generates some text. The Javascript successfully executes when the movie gets to that slide (On Enter: Execute Javascript) but I can't seem to get the generated text to appear within any Captivate screen object.

I created a Captivate text entry box, found it's ID value and tried using the Javascript call:

document.getElementById("myTextBox_inputField").innerHTML="Text from Javascript";

but I can't seem to get the text from my Javascript output to a Captivate object. I feel like I'm missing something obvious with this one....

Thanks in advance,

Rich

This topic has been closed for replies.

2 replies

TLCMediaDesign
Inspiring
September 2, 2016

The syntax for an Input is "value", not innerHTML. You'll need to set a timeout to ensure the element is in the DOM first.

setTimeout(function()

    {    

     var myBox = document.getElementById("myTextBox_inputField").value = "Text from Javascript"; 

   

    }, 0200);

Lilybiri
Legend
August 31, 2016

You have to store that text in a user variable, defined in Captivate, which can be displayed in a text container.

Use the method SetVariableValue which is available in the common JS API for Captivate. More details:

Learn about the Common JavaScript interface for Adobe Captivate