The Essential Guide to HTML5

(Greg DeLong) #1

QUIZ


Code Explanation


thisxn = Number(thisx) + 115;


elementinmotion.style.left =
String(thisxn)+"px";


elementinmotion.style.top =
this.style.top;


makingmove = false;^


if (this.id.substring(1)==
elementinmotion.id.substring(1)) {


elementinmotion.
style.backgroundColor = "gold";


this.style.
backgroundColor = "gold";


document.f.out.value =
"RIGHT";


sc = 1+Number
(document.f.score.value);


Pick up the score, convert to number, and
increment by 1

document.f.score
.value = String(sc);


if (sc==nq) { If game over


v = document
.getElementById("vid");


...find video element

v.style
.visibility = "visible";


...set visibility to visible

v.style.zIndex="10000";


...set zIndex to a very big number

v.play(); ...play the video


} ...close if clause

Free download pdf