« A SCORM-compatible learning module template: Part 5 of 6 | Main | Streaming Flash Video with open-source software »

May 12, 2007

A SCORM-compatible learning module template: Part 6 of 6

Branching behavior

Several branching functions are included in js/branchingToolkit.js and are available to be used in your modules. Note: These haven't been thoroughly tested!
InsertList: This function inserts a new pages into the page list right after the current page To use, you must add a second PageArray to the pageArray.js file, called PageArray2, containing the pages to be inserted.
function insertList(){
	 for(var i=0; i< PageArray2.length; i++) { 
	parent.data.PageArray.splice((window.parent.data.znThisPage-1),0,PageArray2[i]);
	parent.data.determineParents();
	} 
	wipePageNo();
	wipeNavBar();
	printNavBar();
     }
	  function writeArray(){
	  for(var i=0; i< parent.data.PageArray.length; i++) { 
	  document.getElementById('writeItHere').innerHTML +=(parent.data.PageArray[i].url +" " + parent.data.PageArray[i].title +'
'); } }

addOnePagetoEnd: The following function pushes just one new page at a time into the page list. To use, add title, url, chapter and level information to the "mystring" line, similar to what you did when filling out each line in the page array.


function addOnePagetoEnd() {
mystring=({title:'I am new',url:'page303.htm',chapter:0,level:1});
parent.data.PageArray.push(mystring);
document.getElementById('NavBar').innerHTML = ('');
parent.data.determineParents();//haven't testedd yet but you have to run determineParents after modifying the array
wipePageNo();
wipeNavBar();
printNavBar();}



replaceAllPages: This function replaces the entire page list with a new list.
To use, you must add a second PageArray to the pageArray.js file, called PageArray2.

function replaceAllPages() {
	parent.data.PageArray=parent.data.PageArray2;
	parent.data.determineParents();
	wipePageNo();
	wipeNavBar();
    printNavBar();
    NextPage(); }
 //**end branching toolkit**//

For more articles on scorm, web development, powerpoint and other topics, see The Designspace

Posted by emeiselm at May 12, 2007 11:37 AM

Comments

Login to leave a comment. Create a new account.