I used the Java script below to add a system date to the screen. It works fine outside of the LMS, but when run via the LMS it doesn't work...it just shows the variable test 'system date' and not the actual date like it should. Any ideas?
var currentTime = new Date() var month = currentTime.getMonth() + 1 var day = currentTime.getDate() var year = currentTime.getFullYear() var dateString=month + "/" + day + "/" + year var player = GetPlayer(); player.SetVar("SystemDate",dateString);
IF it works fine outside the LMS It may be possible your LMS window block javascript from within the content but I think this would be unlikely. Are you getting any javascript errors? If you do all javascript within the course will not work
Yes, there seems to be something LMS related that's blocking it. However, I just tried using some totally different script and it's now working both inside and outside of the LMS.
Do you remember what you did to fix the problem? I have several courses with this Java Script and just one of them isn't working inside the LMS - I can't see any difference in my coding at all, so just wondering if whatever you changed is what I might be missing.
5 Replies
IF it works fine outside the LMS It may be possible your LMS window block javascript from within the content but I think this would be unlikely. Are you getting any javascript errors? If you do all javascript within the course will not work
Yes, there seems to be something LMS related that's blocking it. However, I just tried using some totally different script and it's now working both inside and outside of the LMS.
Have you tried changing the name of the variable from SystemDate?
Do you remember what you did to fix the problem? I have several courses with this Java Script and just one of them isn't working inside the LMS - I can't see any difference in my coding at all, so just wondering if whatever you changed is what I might be missing.
Hi Miriam,
This thread is a bit older so you may want to message CK1 using the "contact me" button on his profile to see if he's able to share an update.
This discussion is closed. You can start a new discussion or contact Articulate Support.