incomplete script in advanced actions
Hi, everyone! I have a problem that I cant figure out. I've received an existing course from another developer and they have an advanced action set to execute javascript - the code is as follows:
| Original code |
|---|
var winRef = window.open("", "targetWindow", "height=400, width=400, menubar=no, scrollbars=yes", false); var slideRef = window.cpAPIInterface.getCurrentSlideIndex(); var transc = $("#transcript_" + slideRef + "accStr" ).text(); var doc = winRef.document; doc.open("text/html"); doc.write(transc); doc.close(); |
This works, but it's not displaying the text formatting correctly, so i changed it to this:
Updated code |
|---|
var winRef = window.open("", "targetWindow", "height=400, width=400, menubar=no, scrollbars=yes", false); var slideRef = window.cpAPIInterface.getCurrentSlideIndex(); var transc = $("#transcript_" + slideRef + "accStr" ).text(); var splitText = transc.split("|"); var doc = winRef.document; doc.open("text/html"); for (i=0; i<splitText.length; i++) { doc.write(splitText + "<br><br>"); }; doc.close(); |
This code works great when tested in a separate, standalone HTML page, but whenever I try to update it in advanced actions, it wont take changes. When taking things out line by line, I found out it's the for loop that Captivate doesnt like.
What am I missing here? Thanks guys!
