Date Javascript Feb 04, 2021 By Colin Wheeler I have used the code below to insert the date into a presentation, having changed to SL3 the code no longer seems to work: var d = new Date();var datestring = d.getDate() + "-" + (d.getMonth()+1) + "-" + d.getFullYear();player.SetVar ("Date",datestring); Any ideas please!!
Phil Mayor Hero over 2 years ago02/04/21 at 12:33 pm (UTC) Do you have other javascript in the course? This looks OK to me. Are you using jQuery anywhere?
Steve Gannon over 2 years ago02/04/21 at 1:22 pm (UTC) Your code doesn't open communication with Storyline, Colin. Make this your first line: var player = GetPlayer(); Also, double check that you have a variable created in Storyline called Date (an be sure the "D" is uppercase).
Phil Mayor Hero over 2 years ago02/04/21 at 1:24 pm (UTC) Oops, however if it worked before that line must have been in there.
3 Replies
Do you have other javascript in the course? This looks OK to me. Are you using jQuery anywhere?
Your code doesn't open communication with Storyline, Colin. Make this your first line:
var player = GetPlayer();
Also, double check that you have a variable created in Storyline called Date (an be sure the "D" is uppercase).
Oops, however if it worked before that line must have been in there.