JavaScript execution issues
Jun 28, 2016
By
Stefne Jean
Hi, I am trying to run java script in my story line project. that connects a data entry for the name and id number as well as a page number. i want it to be an alert box once the user click starts. in story line the JS is before jumping to next page. (see screen shot)
and this is my code:
var CBTPlayer = GetPlayer();
var CBTData = new Object();
var CBTYourName = player.GetVar('YourNameHere');
var CBTpage = player.GetVar('crpage');
var CBTReference = player.GetVar('ReferenceNumber');
CBTData['CBTNameHere'] = YourNameHere;
CBTData['CBTReference'] = ReferenceNumber;
CBTData['CBTpage'] = 1;
Alert("welcome" + player.GetVar("YourNameHere"));
am I doing something wrong?
6 Replies
Hello Stefne,
Try changing your alert statement to:
alert("Welcome " + CBTPlayer.GetVar("YourNameHere"));
alert should be lowercase and you need to reference CBTPlayer
ok will try it now
I'm not sure what you are using the object for. The complete code could be this.
var CBTPlayer = GetPlayer();
var CBTData = new Object();
CBTData['CBTNameHere'] = CBTPlayer.GetVar("YourNameHere");
CBTData['CBTReference'] = CBTPlayer.GetVar('ReferenceNumber');
CBTData['CBTpage'] = CBTPlayer.GetVar('crpage');
alert("Welcome " + CBTPlayer.GetVar("YourNameHere"));
the object is a data entry box:
This post was removed by the author
thank you this fixed the issue
Hi Stefne,
I'm glad you got the help you needed here, and I also wanted to share a reminder about our best practices for Javascript in the event that they'll help you.
This discussion is closed. You can start a new discussion or contact Articulate Support.