Display system time in Storyline 3 using Javascript

Hi,

I have a Storyline3 project which needs to display the system time, always updating.

I used the following code, but it didn't work.

function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();

// add a zero in front of numbers<10
m = checkTime(m);
s = checkTime(s);

var p=GetPlayer();
p.SetVar("h",h);

var q=GetPlayer();
q.SetVar("m",m);

var r=GetPlayer();
r.SetVar("s",s);

var t = setTimeout(function(){ startTime() }, 1000);
}

function checkTime(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}

 

 

Does anyone know the exact code for this?

Chandi

 

Be the first to reply