The Essential Guide to HTML5

(Greg DeLong) #1

MAZES


Code Explanation


} End try


catch (e) { If a catchable error


alert("data not saved,
error given: "+e);


Display message

} End catch clause


return false; Return false to avoid refresh


} Close function


function getwalls() { Function header getwalls


var swalls; Temporary storage


var sw; Temporary storage


var i; Index


var sx; Hold the sw value


var sy; Hold the sy value


var fx; Hold the fx value


var fy; Hold the fy value


var curwall; Hold walls being created


var lsname = document.gf.glname.value; Extract player's name for storage to be
retrieved


swalls=localStorage.getItem(lsname); Get the storage


if (swalls!=null) { If something was fetched


wallstgs = swalls.split(";"); Split to make an array


for (i=0;i<wallstgs.length;i++) { Loop through this array

Free download pdf