Java script

hi all.

something very strange has happened to me.

I have a button that opens some java script. everything worked fine. but now - it stopped working and I didn't change a thing. I publish as cd and text locally, and also published and tested as web and on a server.

here is the script I used:

this is to print my screen:

 window.print();

this is to open an browser with some variables:

 var player = GetPlayer();
var need = player.GetVar("NeedDevelop");
var important = player.GetVar("Importent");
var activity1 = player.GetVar("SubActiv");
var activity2 = player.GetVar("SubActiv02");
var activity3 = player.GetVar("SubActiv03");
var activity4 = player.GetVar("SubActiv04");
var activity5 = player.GetVar("SubActiv05");
var activity6 = player.GetVar("SubActiv06");
var activity7 = player.GetVar("SubActiv07");
var activity8 = player.GetVar("SubActiv08");
var activity9 = player.GetVar("SubActiv09");
var notes1 = player.GetVar("Implemented01");
var notes2 = player.GetVar("Implemented02");
var notes3 = player.GetVar("Implemented03");
var notes4 = player.GetVar("Implemented04");
var notes5 = player.GetVar("Implemented05");
var notes6 = player.GetVar("Implemented06");
var notes7 = player.GetVar("Implemented07");
var notes8 = player.GetVar("Implemented08");
var notes9 = player.GetVar("Implemented09");
var resources = player.GetVar("Resources");
var timeframe = player.GetVar("WhenActivity");
var evaluate = player.GetVar("HowActivityHelps");
var support = player.GetVar("HelpFromOthers");
newwindow=window.open();
newdocument=newwindow.document; d = new Date();
newdocument.write('<style>body{padding:20px;font-family:arial,sans-serif}</style>'
+' <span style="font-size:24px; font-weight:bold">The Learning Action Plan</span><br>'
+' <span style="font-size:18px;">Here is the summary of the learning plan.</span>'
+' <br><br>'
+' <span style="font-size:16px; font-weight:bold;">Objective: Develop the skill & expertise in '+ need +'.<br>'
+' Relevance: This is important or relevant because '+ important +'.<br>'
+' How: Develop this skill/expertise by:<br><br>'
+ activity1 + ' Notes: '+ notes1 +'.<br>'
+ activity2 + ' Notes: '+ notes2 +'.<br>'
+ activity3 + ' Notes: '+ notes3 +'.<br>'
+ activity4 + ' Notes: '+ notes4 +'.<br>'
+ activity5 + ' Notes: '+ notes5 +'.<br>'
+ activity6 + ' Notes: '+ notes6 +'.<br>'
+ activity7 + ' Notes: '+ notes7 +'.<br>'
+ activity8 + ' Notes: '+ notes8 +'.<br>'
+ activity9 + ' Notes: '+ notes9 +'.<br>'
+' Resources: To be successful with this plan, there is a need of the following resources: '+ resources +'.<br>'
+' Time frame: This plan will begin: '+ timeframe +'.<br>'
+' Evaluate: To evaluate what was learned from this plan: '+ evaluate +'.<br>'
+' Support: ' + support + ' will provide support for this plan.<br>'
+' We hope this plan would be your guide for the coming future.</span>');

and the last one is to open an email with the same variables: 

var player = GetPlayer();

var need = player.GetVar("NeedDevelop");
var important = player.GetVar("Importent");
var activity1 = player.GetVar("SubActiv");
var activity2 = player.GetVar("SubActiv02");
var activity3 = player.GetVar("SubActiv03");
var activity4 = player.GetVar("SubActiv04");
var activity5 = player.GetVar("SubActiv05");
var activity6 = player.GetVar("SubActiv06");
var activity7 = player.GetVar("SubActiv07");
var activity8 = player.GetVar("SubActiv08");
var activity9 = player.GetVar("SubActiv09");
var notes1 = player.GetVar("Implemented01");
var notes2 = player.GetVar("Implemented02");
var notes3 = player.GetVar("Implemented03");
var notes4 = player.GetVar("Implemented04");
var notes5 = player.GetVar("Implemented05");
var notes6 = player.GetVar("Implemented06");
var notes7 = player.GetVar("Implemented07");
var notes8 = player.GetVar("Implemented08");
var notes9 = player.GetVar("Implemented09");
var resources = player.GetVar("Resources");
var timeframe = player.GetVar("WhenActivity");
var evaluate = player.GetVar("HowActivityHelps");
var support = player.GetVar("HelpFromOthers");

var subject="PMC Springboard Learning Action Plan";
var body_text="Here is the summary of the learning plan."+"%0D%0A%0D%0A"+"%0D%0A%0D%0A"+"OBJECTIVE: Develop the skill & expertise in"+need+"%0D%0A%0D%0A"+"%0D%0A%0D%0A"+"Relevance: This is important or relevant because "+important+"%0D%0A%0D%0A"+"%0D%0A%0D%0A"+"How: Develop this skill/expertise by: "+"%0D%0A%0D%0A"+
+activity1+". Notes: "+notes1+"."+"%0D%0A%0D%0A"+activity2+". Notes: "+notes2+"."+"%0D%0A%0D%0A"+activity3+". Notes: "+notes3+"."+"%0D%0A%0D%0A"+activity4+". Notes: "+notes4+"."+"%0D%0A%0D%0A"+activity5+". Notes: "+notes5+"."+"%0D%0A%0D%0A"+activity6+". Notes: "+notes6+"."+"%0D%0A%0D%0A"+activity7+". Notes: "+notes7+"."+"%0D%0A%0D%0A"+activity8+". Notes: "+notes8+"."+"%0D%0A%0D%0A"+activity9+". Notes: "+notes9+"."+"%0D%0A%0D%0A"+"RESOURCES: To be successful with this plan, there is a need of the following resources: "+resources+"%0D%0A%0D%0A"+"%0D%0A%0D%0A"+"Time frame: This plan will begin: "+timeframe+"%0D%0A%0D%0A"+"%0D%0A%0D%0A"+"Evaluate: To evaluate what was learned from this plan: "+evaluate+"%0D%0A%0D%0A"+"%0D%0A%0D%0A"+"Support: "+support+" will provide support for this plan.";
var mailto_link='mailto:'+vEmail+'?subject='+subject+'&body='+body_text;
win=window.open(mailto_link,'emailWin');

 

If any one can help it would be wonderful!

2 Replies
Steve Flowers

Few ways to approach narrowing down the cause. I use a combination of a couple of methods:

  1. Open the developers console in a modern browser and run story. It'll tell you if something is broken in the JS that stops the execution.
  2. Drop an alert into the middle (I'd step it in right after the SL GetVar calls:

alert("working");

If that works, cut and paste the alert half way through the rest of the script. Moving it forward another half if it keeps working and back halfway again between "waypoints" until it works again.