Forum Discussion
JavaScript ?: Can I pull text from a text box into an email?
Hi Everyone,
I'm attempting to add javascript to a button so that it launches an email. My script appears to be working in other projects but isn't launching an email in my new course. Is there anyone who might be able to look over the script and or inspect the project to help me troubleshoot? Thanks in advance for the review!
var email="twasham@company.com";
var subject="Feedback Needed AAA Level 1A Post-Test";
var player = GetPlayer();
var body_start=new Array();
body_start[0]=player.GetVar("question1");
body_start[1]=player.GetVar("question2");
body_start[2]=player.GetVar("question3");
body_start[3]=player.GetVar("question4");
body_start[4]=player.GetVar("question5");
body_start[5]=player.GetVar("question6");
body_start[6]=player.GetVar("question7");
body_start[7]=player.GetVar("question8");
body_text = body_start[0] + "%0D%0A%0D%0A" + body_start[1]+ "%0D%0A%0D%0A" + body_start[2]+ "%0D%0A%0D%0A" + body_start[3]+ "%0D%0A%0D%0A" + body_start[4]+ "%0D%0A%0D%0A" + body_start[5]+ "%0D%0A%0D%0A" + body_start[6]+ "%0D%0A%0D%0A" + body_start[7];
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_text;
win=window.open(mailto_link,'emailWin');