The Essential Guide to HTML5

(Greg DeLong) #1

CHAPTER 6


Code Explanation


thingelem.style.left =
String(col1+inbetween)+"px";


thingelem.addEventListener
('click',pickelement,false);


my +=rowsize;


}^


document.f.score.value = "0";


return false;^


}


function pickelement(ev) {^


var thisx;


var thisxn;^


var sc; Variable for the number of correct matches


if (makingmove) {^


if (this==elementinmotion) { Check that the player hasn't clicked twice on the
same block


elementinmotion.style.backgroundColor =
"white";


If so, reset color to white

makingmove = false; Reset makingmove


return; Return


} Close if clause


thisx= this.style.left;


thisx = thisx.substring
(0,thisx.length-2);

Free download pdf