SL2 Javascript issues

I've read through the threads on this but still can't get resolution on my issue.  I have a short module that has a JS random number generator as follows:

var randomnumber = Math.floor((Math.random()*100)+1);

var player = GetPlayer();

player.SetVar("randnum",randomnumber);

It works in one module but not in another one.  I've published both to CD, allowed permissions in browsers (testing in both IE and Chrome) and used the same JS as above.  These need to ultimately be published to CD and won't run on an LMS.

Any ideas why there's different behaviour-- and how to correct?

 

2 Replies