TheDesignspace
A SCORM-ready template: Part 6 - Branching behaviors


May 12, 2007
Tutorials | SCORM




Branching behaviors


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**//



Posted by ellen at May 12, 2007 07:05 PM | TrackBack

 Comments
 Post a comment
Name:


Email Address:


URL:


Comments:


Remember info?



Recommended Reading