Forum Discussion
lmsAPI Functionality in HTML5 Output
OK so I tried this
---------------------
var player = GetPlayer();
function findLMSAPI(win) {
// look in this window
if (win.hasOwnProperty("GetStudentID")) return win;
// all done if no parent
else if (win.parent == win) return null;
// climb up to parent window & look there
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
player.SetVar("newName", newName);
-----------------------------
And it works!
Thanks so much
Chris
- stephaniekalink7 years agoCommunity Member
Hi Chris, I try to do the same thing but I don't know where to define the variable newName...
i put a trigger to execute the js in the begining of my page
i put the variable in the list of variable and decide is a text variable
i put a text field il my page with the variable insidei published in html5
i have sl 360
and i tried in my lms and it doesn't work...could you help me ?