Java Script help needed!

Mar 31, 2021

Hi Everyone,

I need help with some JS - I'm very new to it and struggling a little.

Background: I have a storyline built and want to have the option for learners to email their various text entries to a third party who will score them.

This is the JS I'm trying to use:

var player = GetPlayer();

 

var useremail=player.GetVar("Emailaddress");

 

var subject="Consolidation 1 Results";

 

var FirstName=player.GetVar("LearnerName");

 

var Surname=player.GetVar("LearnerSurname");

 

var ECNumber=player.GetVar("StaffID");

 

var Scenario1greet=player.GetVar("Scenario1greet");

var Scenario1End=player.GetVar("Scen1End");

var Scenario2greet=player.GetVar("Scenario2greet");

var Scen2response=player.GetVar("Scen2response");

var Scenario2End=play.GetVar("Scenario2End");

 

var mailto_link='mailto:'+useremail+'?subject='+subject+'&body='+"Learner Name:%0d%0A"+FirstName+""+Surname+"

%0d%0A%0d%0ALearner Staff Number:%0d%0A"+ECNumber+"

%0d%0A%0d%0A'+"Scenario 1 – This is how I would greet the customer:%0d%0A"+Scenario1greet+"

%0d%0A%0d%0A'+"Scenario 1 – This is how I would finish the conversation with the customer:%0d%0A"+Scen1End+"

%0d%0A%0d%0A'+"Scenario 2 - My greeting to the customer:%0d%0A"+Scenario2greet+"

%0d%0A%0d%0A'+"Scenario 2 – My response to the customer:%0d%0A"+ Scen2response+"

%0d%0A%0d%0A;'+"Scenario 2 – End of conversation with the customer:%0d%0A"+Scenario2End+";

 

win=window.open(mailto_link,'emailWin');

 

Is anyone able to point out where I'm going wrong and how to fix it?

5 Replies