Hi everyone - I'm hoping someone can help me with a little problem I'm having with some JavaScript code I'm using to retrieve the current date and time in my storyline file.
The issue I am having is with the display of the minutes. Everything works fine when viewing the flash version of the output but in html5 the leading zero does not display when the minutes are under 10. So for example, 7:01 am looks like 7:1
I've attached the slide if anyone wants to take a look.
Hi everyone - I'm hoping someone can help me with a little problem I'm having with some JavaScript code I'm using to retrieve the current date and time in my storyline file.
The issue I am having is with the display of the minutes. Everything works fine when viewing the flash version of the output but in html5 the leading zero does not display when the minutes are under 10. So for example, 7:01 am looks like 7:1
I've attached the slide if anyone wants to take a look.
Hi Nancy,
just use following function in JavaScript to add zeros before numbers less than 10.
// add zeros to numbers, that are only one char length
function padlength(what){
var output=(what.toString().length==1)? "0"+what : what;
Using javascript is great but what about when you want to display your e-learning in the articulate player app or in HTML5 on an iPad. It just doesn't work.
7 Replies
The file did not upload so here it is.
https://dl.dropboxusercontent.com/u/73851/demo1slide.zip
Nancy, the link to the file doesn't work, I get a
Error (404)
We can't find the page you're looking for. Check out our Help Center and forums for help, or head back to home.It was still uploading try again.
Bump
Hi Nancy,
just use following function in JavaScript to add zeros before numbers less than 10.
// add zeros to numbers, that are only one char length
function padlength(what){
var output=(what.toString().length==1)? "0"+what : what;
return output;
}
// init new date object
var serverdate=new Date();
// get minutes and seconds with leading zeros
var minutes = serverdate.getMinutes();
var seconds = serverdate.getSeconds();
-------------------------------------------------------------------------------------
Nice guide to JS Date object: http://www.w3schools.com/jsref/jsref_obj_date.asp
You can see it in action here: http://www.timeutils.com/current-time
I hope it helps.
Jiri
Using javascript is great but what about when you want to display your e-learning in the articulate player app or in HTML5 on an iPad. It just doesn't work.
Hi Gareth,
This thread is a bit older so I'm not certain that folks are still subscribed, but the Javascript is supported in Flash and HTML5 as described here.
This discussion is closed. You can start a new discussion or contact Articulate Support.