我在 new.js 中有获取和设置代码:
APIClass.prototype.LMSGetValue = function (element) {
var value = GetValueJson(element, '1.2', 'LMSGetValue');
return value;
}
APIClass.prototype.LMSSetValue = function (element, value) {
SetValueJson(element, value, '1.2', 'LMSSetValue');
return "true";
}
API_1484_11_Class.prototype.GetValue = function (element) {
var value = GetValueJson(element, '2004 3rd Edition', 'GetValue');
return value;
}
API_1484_11_Class.prototype.SetValue = function (element, value) {
SetValueJson(element, value, '2004 3rd Edition', 'SetValue');
return "true";
}
function SetValueJson(key1, value1, scormVersion, methodCalled) {
if (key1 = "cmi.suspend_data") {
value1 = "none";
}
var obj = {
key: key1,
value: value1
}
setValuesArray.push(obj);
for (var i = setValuesArray.length - 1; i >= 0; i--) {
var array = setValuesArray[i];
if (array.key === key1) {
alert("returning value for key= " + setValuesArray[i].key + " with value as: " + setValuesArray[i].value);
return setValuesArray[i].value;
}
}
//return value1;
}
函数GetValueJson(键,scormVersion,方法调用){
if (scormVersion == '1.2' && methodCalled == 'LMSGetValue')
{
alert("key that must be set for 1.2: " + key);
}
if (scormVersion == '2004 3rd Edition' && methodCalled == 'GetValue') {
alert("key that must be set 2004: " + key);
}
if (key = "cmi.completion_status") {
value = "not completed";
}
if (key = "cmi.location") {
value = "";
}
if (key = "cmi.suspend_data") {
value = "";
}
return value;
}
当我想设置一个值(SetValueJson)并且它与我在 GetValueJson 中获得的值不同时,会发生什么情况,我会弹出一个提示,指出无法存储持久数据。我怎样才能解决这个问题?一些模块使用 1.2 和其他 2004
谢谢