Java script not working

Oct 20, 2020

I am in the process of building an assessment, which requires the following:

- Today's date to be automatically added into certificate at end of course.

- Expiry date (today's date plus 6 months) to be automatically added into certificate at end of course.

- Make course certificate printable.

Having scoured through posts on here, and taking on board lots of the wonderful advice provided. I thought that I had found the correct Java script to be able to achieve the above requirements. However, none of them seem to be working when I test the assessment out on Articulate Review :-(

I have successfully used the print java script before so I'm wondering if it is something other than the script itself that is at fault. The other two were copied directly from other discussion boards and I don't know enough about Java script to know if I have made any errors in those.

If anybody is able to advise where I have gone wrong, or what the problem is likely to be, I would be incredibly grateful. I've pasted the java scripts below and attached a file showing these interactions.

 

Today's date 

var m_names = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth();
var yyyy = today.getFullYear();
if(dd<10) { dd="0"+dd }
var date= dd+' '+m_names[mm]+','+yyyy;
var player = GetPlayer();
player.SetVar("SystemDate",date);

 

Expiry date

vardate1 = new Date();
var daysToMove = 180;
date1.setDate9date1.getDate() + daysToMove);
var player = GetPlayer();
player.SetVar("expirydate",date1.toDateString90.replace(/^\S+\s/,") );

 

Print

window.print();

 

Thanks!

Jo

4 Replies

This discussion is closed. You can start a new discussion or contact Articulate Support.