View Single Post
Old 08-18-2010, 02:00 PM   PM User | #2
spuntotheratboy
New to the CF scene

 
Join Date: Aug 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
spuntotheratboy is an unknown quantity at this point
I've been working on this, of course, and substantially re-written the code after testing it in an on-line validator. Now it's started working in IE8 but stopped in Firefox, still working in Safari, failing in Chrome on a Mac but partly working (i.e. I'm seeing some alerts but not others) in Chrome in Windows... so that proves the error is in my code, somewhere, although it passes a fairly strict on-line validator. The 'increment' variable is just my own versioning so I can make sure that I'm not seeing results from a cached version of the API. Here's the new code in full:

Code:
var mySIScormAlertStr = '';
function LMSInitialize() {
	mySIScormAlertStr = 'LMSInitialize() - ' + this.increment;
	alert(mySIScormAlertStr);
	return true;
}
function LMSFinish() {
	mySIScormAlertStr = 'LMSFinish() - ' + this.increment;
	alert(mySIScormAlertStr);
	return true;
}
function LMSGetValue(varName) {
	mySIScormAlertStr = 'LMSGetValue() - ' + this.increment + '\nvarName\t' + varName;
	alert(mySIScormAlertStr);
	return true;
}
function LMSSetValue(varName, varValue) {
	mySIScormAlertStr = 'LMSSetValue() - ' + this.increment + '\nvarName\t' + varName + '\nvarValue\t' + varValue;
	alert(mySIScormAlertStr);
	return true;
}
function LMSCommit() {
	mySIScormAlertStr = 'LMSCommit() - ' + this.increment;
	alert(mySIScormAlertStr);
	return true;
}
function LMSGetLastError() {
	mySIScormAlertStr = 'LMSGetLastError() - ' + this.increment;
	alert(mySIScormAlertStr);
	return true;
}
function LMSGetErrorString() {
	mySIScormAlertStr = 'LMSGetErrorString() - ' + this.increment;
	alert(mySIScormAlertStr);
	return true;
}
function LMSGetDiagnostic() {
	mySIScormAlertStr = 'LMSGetDiagnostic() - ' + this.increment;
	alert(mySIScormAlertStr);
	return true;
}
function SIScormAPI() {
	this.version = '1.2';
	this.increment = '23';
	this.error = '0';
	this.initialized = false;
	this.keepValues = {};

	this.LMSInitialize = LMSInitialize;
	this.LMSFinish = LMSFinish;
	this.LMSGetValue = LMSGetValue;
	this.LMSSetValue = LMSSetValue;
	this.LMSCommit = LMSCommit;
	this.LMSGetLastError = LMSGetLastError;
	this.LMSGetErrorString = LMSGetErrorString;
	this.LMSGetDiagnostic = LMSGetDiagnostic;
}
var API = new SIScormAPI();
Thanks to everybody who's reading this - I'd be really grateful for any kind of hint as to why it's working on some browsers and not others!

Cheers,
Ben
spuntotheratboy is offline   Reply With Quote