[inclScorm1.2] //JMATCH-SPECIFIC SCORM-RELATED JAVASCRIPT CODE function SetScormScore(){ //Reports the current score and any other information back to the LMS if (API != null){ API.LMSSetValue('cmi.core.score.raw', Score); //Now send a detailed reports on the item var ItemLabel = 'Matching'; API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel); API.LMSSetValue('cmi.interactions.0.id', 'int'+ItemLabel); API.LMSSetValue('cmi.objectives.0.status', API.LMSGetValue('cmi.core.lesson_status')); API.LMSSetValue('cmi.objectives.0.score.min', '0'); API.LMSSetValue('cmi.objectives.0.score.max', '100'); API.LMSSetValue('cmi.objectives.0.score.raw', Score); //We can only use the performance type, because we're storing multiple responses of various types. API.LMSSetValue('cmi.interactions.0.type', 'performance'); var AnswersTried = ''; for (var i=0; i0){AnswersTried += ' | ';} for (var j=0; j0){AnswersTried += ',';} AnswersTried += j + '.' + Status[j][3][i]; } } API.LMSSetValue('cmi.interactions.0.student_response', AnswersTried); API.LMSCommit(''); } } [/inclScorm1.2] //JMATCH CORE JAVASCRIPT CODE var CorrectIndicator = '[strCorrectIndicator]'; var IncorrectIndicator = '[strIncorrectIndicator]'; var YourScoreIs = '[strYourScoreIs]'; var CorrectResponse = '[strGuessCorrect]'; var IncorrectResponse = '[strGuessIncorrect]'; var TotalUnfixedLeftItems = 0; var TotCorrectChoices = 0; var Penalties = 0; var Finished = false; var TimeOver = false; var Score = 0; var Locked = false; var ShuffleQs = [boolShuffleQs]; var QsToShow = [QsToShow]; function StartUp(){ RemoveBottomNavBarForIE(); [inclScorm1.2] ScormStartUp(); [/inclScorm1.2] [inclSendResults] GetUserName(); [/inclSendResults] [inclPreloadImages] PreloadImages([PreloadImageList]); [/inclPreloadImages] SetUpItems(ShuffleQs,QsToShow); TotalUnfixedLeftItems = document.getElementById('MatchDiv').getElementsByTagName('select').length; //Create arrays CreateStatusArrays(); [inclTimer] StartTimer(); [/inclTimer] } Status = new Array(); function CreateStatusArrays(){ var Selects = document.getElementById('Questions').getElementsByTagName('select'); for (var x=0; x 0){ var Select = Container.getElementsByTagName('select')[0]; if (Select != null){ Result = parseInt(Select.id.substring(1, Select.id.length)); } } return Result; } function GetKeyFromSelect(Select){ var Result = -1; if (Select != null){ Result = parseInt(Select.id.substring(1, Select.id.length)); } return Result; } var OriginalKeys = new Array(); var ReducedKeys = new Array(); function GetUniqueKeys(Container, TargetArray){ TargetArray.length = 0; var x = -1; var SList = Container.getElementsByTagName('select'); if (SList.length > 0){ for (var i=0; i 0){ QList.push(Qs.removeChild(Qs.getElementsByTagName('tr')[0])); } var Reducing = (QList.length > ReduceTo); //If required, select random rows to delete if (Reducing == true){ var DumpItem = 0; while (ReduceTo < QList.length){ //Get a number to delete from the array DumpItem = Math.floor(QList.length*Math.random()); for (i=DumpItem; i<(QList.length-1); i++){ QList[i] = QList[i+1]; } QList.length = QList.length-1; } } //Shuffle the rows if necessary if (ShuffleQs == true){ QList = Shuffle(QList); } TotalUnfixedLeftItems = QList.length; //Write the rows back to the table body for (i=0; i=0; j--){ if (OptionRequired(Options[j].value) == false){ Selects[i].removeChild(Options[j]); } } } } } function OptionRequired(Key){ if (ReducedKeys.indexOf(Key) > -1){ return true; } else{ if (OriginalKeys.indexOf(Key) > -1){ return false; } else{ return true; } } } function CheckAnswers(){ if (Locked == true){return;} var Select = null; var Key = -1; var Parent = null; var Answer = null; var AnsText = ''; var AllDone = true; TotCorrectChoices = 0; //for each item not fixed or a distractor for (var i=0; i' + YourScoreIs + Score + '%.'; } else{ Feedback = IncorrectResponse + '
' + YourScoreIs + Score + '%.'; //Penalty for incorrect check Penalties++; } //If the exercise is over, deal with that if ((AllDone == true)||(TimeOver == true)){ [inclSendResults] setTimeout('SendResults(' + Score + ')', 50); [/inclSendResults] [inclTimer] window.clearInterval(Interval); [/inclTimer] TimeOver = true; Locked = true; Finished = true; setTimeout('Finish()', SubmissionTimeout); WriteToInstructions(Feedback); } //Show the feedback ShowMessage(Feedback); [inclScorm1.2] if (AllDone == true){ SetScormComplete(); } else{ SetScormIncomplete(); } [/inclScorm1.2] } [inclTimer] function TimesUp() { document.getElementById('Timer').innerHTML = '[strTimesUp]'; [inclPreloadImages] RefreshImages(); [/inclPreloadImages] TimeOver = true; Finished = true; CheckAnswers(); Locked = true; [inclScorm1.2] SetScormTimedOut(); [/inclScorm1.2] } [/inclTimer]